Fix KeyError when forgetting a room

This commit is contained in:
miruka 2020-06-05 01:39:17 -04:00
parent 43468c25e3
commit b81dea9bc2
2 changed files with 6 additions and 3 deletions

View File

@ -93,6 +93,8 @@ and this project adheres to
- Starting a direct chat, creating or joining a room will now correctly - Starting a direct chat, creating or joining a room will now correctly
update the left pane room list's highlighted item update the left pane room list's highlighted item
- Fix `KeyError` when forgetting a room
## 0.5.0 ## 0.5.0
### Added ### Added

View File

@ -727,7 +727,7 @@ class MatrixClient(nio.AsyncClient):
replace the local one we registered. replace the local one we registered.
""" """
our_info = self.models[self.user_id, room_id, "members"][self.user_id] our_info = self.models["accounts"][self.user_id]
content = event_fields.get("content", "").strip() content = event_fields.get("content", "").strip()
@ -782,9 +782,10 @@ class MatrixClient(nio.AsyncClient):
member list when the user is currently viewing the room. member list when the user is currently viewing the room.
""" """
room = self.all_rooms[room_id] # Room may be gone by the time this is called due to room_forget()
room = self.all_rooms.get(room_id)
if not room.members_synced: if room and not room.members_synced:
await super().joined_members(room_id) await super().joined_members(room_id)
await self.register_nio_room(room, force_register_members=True) await self.register_nio_room(room, force_register_members=True)