From f58d62d339f534416cf1df2283bd6c7c20e90810 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 11 Jan 2023 18:21:11 +0000 Subject: [PATCH] Fix accessing room prop which is optional (#9523) Co-authored-by: Michael Weimann --- src/components/views/rooms/RoomPreviewBar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/RoomPreviewBar.tsx b/src/components/views/rooms/RoomPreviewBar.tsx index b455388196..e4d677eda2 100644 --- a/src/components/views/rooms/RoomPreviewBar.tsx +++ b/src/components/views/rooms/RoomPreviewBar.tsx @@ -498,9 +498,10 @@ export default class RoomPreviewBar extends React.Component { } const myUserId = MatrixClientPeg.get().getUserId(); - const memberEventContent = this.props.room.currentState.getMember(myUserId).events.member.getContent(); + const member = this.props.room?.currentState.getMember(myUserId); + const memberEventContent = member?.events.member?.getContent(); - if (memberEventContent.reason) { + if (memberEventContent?.reason) { reasonElement = (