From a2c2087162b3b653a0c2804bde3dfe6981e68629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sat, 18 Mar 2023 22:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20`TypeError`=20exception=20?= =?UTF-8?q?caused=20by=20`data`=20is=20None?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/tools/genshin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/tools/genshin.py b/plugins/tools/genshin.py index 51c7ed8..39e18dc 100644 --- a/plugins/tools/genshin.py +++ b/plugins/tools/genshin.py @@ -116,6 +116,9 @@ class CharacterDetails(Plugin): logger.warning("非法Key %s", key) continue data = await self.redis.get(key) + if data is None: + logger.warning("Redis key[%s] 数据未找到", key) # 如果未找到可能因为处理过程中已经过期,导致该数据未回写到 MySQL + continue str_data = str(data, encoding="utf-8") async with AsyncSession(self.mysql.engine) as session: statement = (