Fix crash on redactions without because

This commit is contained in:
Nicolas Werner 2021-11-29 14:55:17 +01:00
parent 0d43eb1e11
commit b505fa42d5
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 5 additions and 3 deletions

View File

@ -1814,11 +1814,13 @@ TimelineModel::formatRedactedEvent(QString id)
QString reason = ""; QString reason = "";
auto because = event->unsigned_data.redacted_because; auto because = event->unsigned_data.redacted_because;
// User info about who actually sent the redacted event. // User info about who actually sent the redacted event.
QString redactedUser = QString::fromStdString(because->sender).toHtmlEscaped(); QString redactedUser;
QString redactedName = utils::replaceEmoji(displayName(redactedUser)); QString redactedName;
if (because.has_value()) { if (because.has_value()) {
reason = QString::fromStdString(because->content.reason).toHtmlEscaped(); redactedUser = QString::fromStdString(because->sender).toHtmlEscaped();
redactedName = utils::replaceEmoji(displayName(redactedUser));
reason = QString::fromStdString(because->content.reason).toHtmlEscaped();
} }
if (reason.isEmpty()) { if (reason.isEmpty()) {