mirror of
https://github.com/MetaCubeX/Clash.Meta.git
synced 2025-04-20 01:00:56 +00:00
fix(character): check type before access
Check type before access relic's values in validator.
This commit is contained in:
parent
2137332b7e
commit
2894966b6c
1 changed files with 3 additions and 2 deletions
|
@ -142,8 +142,9 @@ class Character(BaseModel):
|
|||
@root_validator(pre=True)
|
||||
def dict_to_list(cls, data: dict[str, Any]):
|
||||
# The keys of the original dict is not necessary, so remove them here.
|
||||
if data.get("relic") is not None:
|
||||
data["relic"] = list(data["relic"].values())
|
||||
if isinstance(data, dict) and data.get("relic") is not None:
|
||||
if isinstance(data["relic"], dict):
|
||||
data["relic"] = list(data["relic"].values())
|
||||
return data
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Reference in a new issue