From 92df0a35a9bd1580d2f221f03dd0fce1813515b0 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 25 Oct 2021 14:55:08 +0100 Subject: [PATCH] null-guard space store getParents relation lookup (#7029) --- src/stores/SpaceStore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/SpaceStore.ts b/src/stores/SpaceStore.ts index bc05ca738b..ea5ff56aea 100644 --- a/src/stores/SpaceStore.ts +++ b/src/stores/SpaceStore.ts @@ -315,7 +315,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient { // child relations, as per MSC1772. // https://github.com/matrix-org/matrix-doc/blob/main/proposals/1772-groups-as-rooms.md#relationship-between-rooms-and-spaces const parent = this.matrixClient.getRoom(ev.getStateKey()); - const relation = parent.currentState.getStateEvents(EventType.SpaceChild, roomId); + const relation = parent?.currentState.getStateEvents(EventType.SpaceChild, roomId); if (!parent?.currentState.maySendStateEvent(EventType.SpaceChild, userId) || // also skip this relation if the parent had this child added but then since removed it (relation && !Array.isArray(relation.getContent().via))