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

View file

@ -1814,11 +1814,13 @@ TimelineModel::formatRedactedEvent(QString id)
QString reason = "";
auto because = event->unsigned_data.redacted_because;
// User info about who actually sent the redacted event.
QString redactedUser = QString::fromStdString(because->sender).toHtmlEscaped();
QString redactedName = utils::replaceEmoji(displayName(redactedUser));
QString redactedUser;
QString redactedName;
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()) {