Merge pull request #4796 from matrix-org/travis/room-list/bug/crash-filter

Fix crash when filtering new room list too fast
pull/21833/head
Travis Ralston 2020-06-18 16:53:42 -06:00 committed by GitHub
commit f136ba4a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -240,6 +240,7 @@ export class ListNotificationState extends EventEmitter implements IDestroyable
this.rooms = rooms; this.rooms = rooms;
for (const oldRoom of diff.removed) { for (const oldRoom of diff.removed) {
const state = this.states[oldRoom.roomId]; const state = this.states[oldRoom.roomId];
if (!state) continue; // We likely just didn't have a badge (race condition)
delete this.states[oldRoom.roomId]; delete this.states[oldRoom.roomId];
state.off(NOTIFICATION_STATE_UPDATE, this.onRoomNotificationStateUpdate); state.off(NOTIFICATION_STATE_UPDATE, this.onRoomNotificationStateUpdate);
state.destroy(); state.destroy();