From 44553cc375d92c99ecd522c8216a5bdc0ab49e84 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Thu, 12 May 2022 16:32:39 +0530 Subject: [PATCH] Fix crash in room without create state event (#546) --- src/app/molecules/room-visibility/RoomVisibility.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/molecules/room-visibility/RoomVisibility.jsx b/src/app/molecules/room-visibility/RoomVisibility.jsx index 746a07a..7a85287 100644 --- a/src/app/molecules/room-visibility/RoomVisibility.jsx +++ b/src/app/molecules/room-visibility/RoomVisibility.jsx @@ -70,7 +70,7 @@ function RoomVisibility({ roomId }) { const noSpaceParent = currentState.getStateEvents('m.space.parent').length === 0; const mCreate = currentState.getStateEvents('m.room.create')[0]?.getContent(); - const roomVersion = Number(mCreate.room_version); + const roomVersion = Number(mCreate?.room_version ?? 0); const myPowerlevel = room.getMember(mx.getUserId())?.powerLevel || 0; const canChange = room.currentState.hasSufficientPowerLevelFor('state_default', myPowerlevel);