Skip to content

Commit

Permalink
Fix a crash when opening a room v11.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Aug 4, 2023
1 parent 04c7a02 commit 25d1ce3
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -833,35 +833,39 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent*)event
NSString *creatorId;
MXJSONModelSetString(creatorId, event.content[@"creator"]);

if (creatorId)
if (!creatorId)
{
if ([creatorId isEqualToString:mxSession.myUserId])
// Room version 11 removes `creator` in favour of `sender`.
// https://github.com/matrix-org/matrix-spec-proposals/pull/2175
creatorId = event.sender;
}

if ([creatorId isEqualToString:mxSession.myUserId])
{
if (isRoomDirect)
{
if (isRoomDirect)
{
displayText = [VectorL10n noticeRoomCreatedByYouForDm];
}
else
{
displayText = [VectorL10n noticeRoomCreatedByYou];
}
displayText = [VectorL10n noticeRoomCreatedByYouForDm];
}
else
{
if (isRoomDirect)
{
displayText = [VectorL10n noticeRoomCreatedForDm:(roomState ? [roomState.members memberName:creatorId] : creatorId)];
}
else
{
displayText = [VectorL10n noticeRoomCreated:(roomState ? [roomState.members memberName:creatorId] : creatorId)];
}
displayText = [VectorL10n noticeRoomCreatedByYou];
}
// Append redacted info if any
if (redactedInfo)
}
else
{
if (isRoomDirect)
{
displayText = [NSString stringWithFormat:@"%@ %@", displayText, redactedInfo];
displayText = [VectorL10n noticeRoomCreatedForDm:(roomState ? [roomState.members memberName:creatorId] : creatorId)];
}
else
{
displayText = [VectorL10n noticeRoomCreated:(roomState ? [roomState.members memberName:creatorId] : creatorId)];
}
}
// Append redacted info if any
if (redactedInfo)
{
displayText = [NSString stringWithFormat:@"%@ %@", displayText, redactedInfo];
}
break;
}
Expand Down

0 comments on commit 25d1ce3

Please sign in to comment.