Skip to content

Commit

Permalink
fix(event): prevent error calls
Browse files Browse the repository at this point in the history
  • Loading branch information
InfinityPacer committed Sep 30, 2024
1 parent 666f9a5 commit 835e0b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/core/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ def check(self, etype: Union[EventType, ChainEventType]) -> bool:
:return: 返回是否存在可用的处理器
"""
if isinstance(etype, ChainEventType):
handlers = self.__chain_subscribers.get(etype, [])
handlers = self.__chain_subscribers.get(etype, {})
return any(
self.__is_handler_enabled(handler)
for _, handler in handlers
for _, handler in handlers.values()
)
else:
handlers = self.__broadcast_subscribers.get(etype, [])
handlers = self.__broadcast_subscribers.get(etype, {})
return any(
self.__is_handler_enabled(handler)
for handler in handlers
for handler in handlers.values()
)

def send_event(self, etype: Union[EventType, ChainEventType], data: Optional[Dict] = None,
Expand Down

0 comments on commit 835e0b4

Please sign in to comment.