mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08: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
@ -142,7 +142,8 @@ class Character(BaseModel):
|
|||||||
@root_validator(pre=True)
|
@root_validator(pre=True)
|
||||||
def dict_to_list(cls, data: dict[str, Any]):
|
def dict_to_list(cls, data: dict[str, Any]):
|
||||||
# The keys of the original dict is not necessary, so remove them here.
|
# The keys of the original dict is not necessary, so remove them here.
|
||||||
if data.get("relic") is not None:
|
if isinstance(data, dict) and data.get("relic") is not None:
|
||||||
|
if isinstance(data["relic"], dict):
|
||||||
data["relic"] = list(data["relic"].values())
|
data["relic"] = list(data["relic"].values())
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user