Fix key error "showNameCardIdList"

This commit is contained in:
M-307 2022-07-18 15:54:09 +07:00
parent 5fed277f21
commit 028fc1eab6

View File

@ -119,4 +119,4 @@ class PlayerInfo(BaseModel):
super().__init__(**data)
__pydantic_self__.namecard = Namecard(id=data["nameCardId"])
__pydantic_self__.namecards = [Namecard(id=namecard) for namecard in data["showNameCardIdList"]]
__pydantic_self__.namecards = [Namecard(id=namecard) for namecard in (data["showNameCardIdList"] if "showNameCardIdList" in data else [])]