From ad2f704e76d31c25933f257cf62829a67e9739c0 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 10 May 2020 11:17:21 +0100 Subject: [PATCH] don't NPE on invites from Dendrite --- src/components/structures/RoomView.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 69a2e54a2c..f53929df4a 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1717,8 +1717,11 @@ export default createReactClass({ } else { const myUserId = this.context.credentials.userId; const myMember = this.state.room.getMember(myUserId); - const inviteEvent = myMember.events.member; - var inviterName = inviteEvent.sender ? inviteEvent.sender.name : inviteEvent.getSender(); + const inviteEvent = myMember ? myMember.events.member : null; + let inviterName = _t("Unknown"); + if (inviteEvent) { + inviterName = inviteEvent.sender ? inviteEvent.sender.name : inviteEvent.getSender(); + } // We deliberately don't try to peek into invites, even if we have permission to peek // as they could be a spam vector.