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

null-guard space store getParents relation lookup #7029

Merged
merged 1 commit into from
Oct 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/stores/SpaceStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
// 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))
Expand Down