Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 92df0a3

Browse files
authored
null-guard space store getParents relation lookup (#7029)
1 parent be0fa6d commit 92df0a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/stores/SpaceStore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
315315
// child relations, as per MSC1772.
316316
// https://github.com/matrix-org/matrix-doc/blob/main/proposals/1772-groups-as-rooms.md#relationship-between-rooms-and-spaces
317317
const parent = this.matrixClient.getRoom(ev.getStateKey());
318-
const relation = parent.currentState.getStateEvents(EventType.SpaceChild, roomId);
318+
const relation = parent?.currentState.getStateEvents(EventType.SpaceChild, roomId);
319319
if (!parent?.currentState.maySendStateEvent(EventType.SpaceChild, userId) ||
320320
// also skip this relation if the parent had this child added but then since removed it
321321
(relation && !Array.isArray(relation.getContent().via))

0 commit comments

Comments
 (0)