fix: fix 'NoneType' object does not support item assignment error (#2525)

### Problem Description
When `context` is `None`, it should not be used for assignment operations.

### Solution
Adjusted the code logic to ensure that `context` is not `None` before performing any item assignment.
This commit is contained in:
6vision
2025-04-20 16:27:44 +08:00
parent 3db5e70a3d
commit 931fbc3eb5
2 changed files with 4 additions and 4 deletions

View File

@@ -146,6 +146,7 @@ class ChatChannel(Channel):
elif context["origin_ctype"] == ContextType.VOICE: # 如果源消息是私聊的语音消息,允许不匹配前缀,放宽条件
pass
else:
logger.info("[chat_channel]receive single chat msg, but checkprefix didn't match")
return None
content = content.strip()
img_match_prefix = check_prefix(content, conf().get("image_create_prefix",[""]))