Fix command finding bug

This commit is contained in:
Richard Chien 2018-12-21 23:39:45 +08:00
parent 034f121cc0
commit f38c3e1c30
2 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,10 @@ sidebar: auto
# 更新日志
## next
- 修复调用不存在的多级命令(例如 `/echo/nonexist`)时,抛出异常导致 WebSocket 连接断开的问题
## v0.4.3
- 自然语言处理器支持响应只有机器人昵称而没有实际内容的消息,通过 `on_natural_language``allow_empty_message` 参数开启(默认关闭)

View File

@ -164,7 +164,7 @@ def _find_command(name: Union[str, CommandName_T]) -> Optional[Command]:
cmd_tree = _registry
for part in cmd_name[:-1]:
if part not in cmd_tree:
if part not in cmd_tree or not isinstance(cmd_tree[part], dict):
return None
cmd_tree = cmd_tree[part]