Fix accessing room prop which is optional (#9523)
Co-authored-by: Michael Weimann <michaelw@matrix.org>
This commit is contained in:
parent
575508ae15
commit
f58d62d339
1 changed files with 3 additions and 2 deletions
|
@ -498,9 +498,10 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const myUserId = MatrixClientPeg.get().getUserId();
|
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 = (
|
reasonElement = (
|
||||||
<InviteReason
|
<InviteReason
|
||||||
reason={memberEventContent.reason}
|
reason={memberEventContent.reason}
|
||||||
|
|
Loading…
Reference in a new issue