From 061e2a28e6befda013cb93e6eb26aaf0c5bff8a4 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Wed, 29 Nov 2023 18:02:32 +0800 Subject: [PATCH] :bug: Fix merge player card info TypeError --- modules/playercards/file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/playercards/file.py b/modules/playercards/file.py index 51d8705e..9be156ac 100644 --- a/modules/playercards/file.py +++ b/modules/playercards/file.py @@ -65,7 +65,8 @@ class PlayerCardsFile: if old_data is None: await self.save_json(self.get_file_path(uid), 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"]] for i in old_data.get("avatarInfoList", []): if i.get("avatarId", 0) not in characters: