Check if room is defined

Sometimes it isn't and that leads to errors. We can't use ? here because we also use !

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-03-26 13:39:16 +01:00
parent 65ef2b845e
commit f64008e239
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -498,7 +498,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
// 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)) || {};