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)) || {};