From a16e6dab4decc831e706441e68c2e672d41a37f6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 12 Nov 2021 10:39:52 +0000 Subject: [PATCH] Guard around SpaceStore onAccountData handler prevEvent (#7123) --- src/stores/spaces/SpaceStore.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stores/spaces/SpaceStore.ts b/src/stores/spaces/SpaceStore.ts index 5cea148b78..83e6ae07ad 100644 --- a/src/stores/spaces/SpaceStore.ts +++ b/src/stores/spaces/SpaceStore.ts @@ -748,9 +748,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient { } }; - private onAccountData = (ev: MatrixEvent, lastEvent: MatrixEvent) => { + private onAccountData = (ev: MatrixEvent, prevEvent?: MatrixEvent) => { if (!this.allRoomsInHome && ev.getType() === EventType.Direct) { - const lastContent = lastEvent.getContent(); + const lastContent = prevEvent?.getContent() ?? {}; const content = ev.getContent(); const diff = objectDiff>(lastContent, content);