fix(process): 判断消息类型时的数组越界风险

This commit is contained in:
Rock Chin
2023-02-25 10:47:52 +08:00
parent e7c79a5156
commit bf1896f959

View File

@@ -138,7 +138,7 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes
if hasattr(config, "rate_limitation"):
ratelimit.add_usage(session_name)
if reply is not None and (type(reply[0]) == str or type(reply[0]) == mirai.Plain):
if reply is not None and len(reply) > 0 and (type(reply[0]) == str or type(reply[0]) == mirai.Plain):
logging.info(
"回复[{}]文字消息:{}".format(session_name,
reply[0][:min(100, len(reply[0]))] + (