Skip to content

Commit

Permalink
Fix potential KeyError in StateStore
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Aug 15, 2019
1 parent 72190e3 commit e5a2b81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mautrix/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "0.4.0.dev59"
__version__ = "0.4.0.dev60"
__author__ = "Tulir Asokan <[email protected]>"
__all__ = ["api", "appservice", "bridge", "client", "errors", "util", "types"]
5 changes: 4 additions & 1 deletion mautrix/appservice/state_store/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def set_typing(self, room_id: RoomID, user_id: UserID, is_typing: bool,
ts = int(round(time.time() * 1000))
self.typing[(room_id, user_id)] = ts + timeout
else:
del self.typing[(room_id, user_id)]
try:
del self.typing[(room_id, user_id)]
except KeyError:
pass

def is_typing(self, room_id: RoomID, user_id: UserID) -> bool:
ts = int(round(time.time() * 1000))
Expand Down

0 comments on commit e5a2b81

Please sign in to comment.