🐛 Fix merge player card info TypeError

This commit is contained in:
xtaodada 2023-11-29 18:02:32 +08:00
parent 416fb40d39
commit 061e2a28e6
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -65,7 +65,8 @@ class PlayerCardsFile:
if old_data is None: if old_data is None:
await self.save_json(self.get_file_path(uid), data) await self.save_json(self.get_file_path(uid), data)
return data return data
data["avatarInfoList"] = data.get("avatarInfoList", []) if data.get("avatarInfoList") is None:
data["avatarInfoList"] = []
characters = [i.get("avatarId", 0) for i in data["avatarInfoList"]] characters = [i.get("avatarId", 0) for i in data["avatarInfoList"]]
for i in old_data.get("avatarInfoList", []): for i in old_data.get("avatarInfoList", []):
if i.get("avatarId", 0) not in characters: if i.get("avatarId", 0) not in characters: