null guard group inviter for corrupted groups

This commit is contained in:
Michael Telatynski 2020-08-17 10:59:43 +01:00
parent 27df9c038d
commit 70f0701de5

View file

@ -1003,9 +1003,10 @@ export default createReactClass({
this.state.inviterProfile.avatarUrl, 36, 36, this.state.inviterProfile.avatarUrl, 36, 36,
) : null; ) : null;
let inviterName = group.inviter.userId; const inviter = group.inviter || {};
let inviterName = inviter.userId;
if (this.state.inviterProfile) { if (this.state.inviterProfile) {
inviterName = this.state.inviterProfile.displayName || group.inviter.userId; inviterName = this.state.inviterProfile.displayName || inviter.userId;
} }
return <div className="mx_GroupView_membershipSection mx_GroupView_membershipSection_invited"> return <div className="mx_GroupView_membershipSection mx_GroupView_membershipSection_invited">
<div className="mx_GroupView_membershipSubSection"> <div className="mx_GroupView_membershipSubSection">
@ -1016,7 +1017,7 @@ export default createReactClass({
height={36} height={36}
/> />
{ _t("%(inviter)s has invited you to join this community", { { _t("%(inviter)s has invited you to join this community", {
inviter: inviterName, inviter: inviterName || _t("Someone"),
}) } }) }
</div> </div>
<div className="mx_GroupView_membership_buttonContainer"> <div className="mx_GroupView_membership_buttonContainer">