From f64008e23916fa6b65034dcab7304d69eec43a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 26 Mar 2021 13:39:16 +0100 Subject: [PATCH] Check if room is defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes it isn't and that leads to errors. We can't use ? here because we also use ! Signed-off-by: Šimon Brandner --- src/stores/SpaceStore.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index 1a9df5a9b3..f07616aed3 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -498,7 +498,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient { // We don't want to save if the room is a // space room since it can cause problems - if (!room.isSpaceRoom()) { + if (room && !room.isSpaceRoom()) { const activeSpaceId = this.activeSpace?.roomId || LAST_VIEWED_ROOMS_HOME; const lastViewedRooms = JSON.parse(window.localStorage.getItem(LAST_VIEWED_ROOMS)) || {};