Fix crash on empty image packs

This commit is contained in:
Nicolas Werner 2022-07-18 18:24:24 +02:00
parent eb33c9a225
commit fd6742ec00
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -2310,7 +2310,7 @@ TimelineModel::formatImagePackEvent(const QString &id)
auto sender = utils::replaceEmoji(displayName(QString::fromStdString(event->sender)));
const auto packId = [&event]() -> QString {
if (!event->content.pack->display_name.empty()) {
if (event->content.pack && !event->content.pack->display_name.empty()) {
return event->content.pack->display_name.c_str();
} else if (!event->state_key.empty()) {
return event->state_key.c_str();