From 1532048f33a02ae88055c0452926b5c78d3decfb Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 8 Sep 2020 16:49:50 +0100 Subject: [PATCH] Fix behaviour WidgetStore for new/unknown rooms --- src/stores/WidgetStore.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/stores/WidgetStore.ts b/src/stores/WidgetStore.ts index a43a6bfc30..d29ee81e13 100644 --- a/src/stores/WidgetStore.ts +++ b/src/stores/WidgetStore.ts @@ -196,11 +196,12 @@ export default class WidgetStore extends AsyncStoreWithClient { } public getApps(room: Room, pinned?: boolean): IApp[] { - const apps = this.getRoom(room.roomId).widgets; + const roomInfo = this.getRoom(room.roomId); + if (!roomInfo) return []; if (pinned) { - return apps.filter(app => this.isPinned(app.id)); + return roomInfo.widgets.filter(app => this.isPinned(app.id)); } - return apps + return roomInfo.widgets; } }