From fd6742ec001cbeeece8b87c2342a3939bad88e64 Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Mon, 18 Jul 2022 18:24:24 +0200
Subject: [PATCH] Fix crash on empty image packs

---
 src/timeline/TimelineModel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 0a9aae6a6..5818d9d8d 100644
--- a/src/timeline/TimelineModel.cpp
+++ b/src/timeline/TimelineModel.cpp
@@ -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();
-- 
GitLab