From d33a0c664475457c5e04b8395346b1bbe0d3d938 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sat, 6 May 2023 21:04:49 +0200 Subject: [PATCH] Fix another imagepack crash --- src/imagepacksmodel.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/imagepacksmodel.cpp b/src/imagepacksmodel.cpp index 8024b5542..14b5fc7ec 100644 --- a/src/imagepacksmodel.cpp +++ b/src/imagepacksmodel.cpp @@ -83,10 +83,13 @@ void ImagePacksModel::setRoom(NeoChatRoom *room) const auto &stickerRoom = m_room->connection()->room(roomId); for (const auto &packKey : packs.keys()) { #ifdef QUOTIENT_07 - const auto packContent = stickerRoom->currentState().get(packKey)->content(); - if (!packContent.pack->usage || (packContent.pack->usage->contains("emoticon") && showEmoticons()) - || (packContent.pack->usage->contains("sticker") && showStickers())) { - m_events += packContent; + const auto &pack = stickerRoom->currentState().get(packKey); + if (pack) { + const auto packContent = pack->content(); + if (!packContent.pack->usage || (packContent.pack->usage->contains("emoticon") && showEmoticons()) + || (packContent.pack->usage->contains("sticker") && showStickers())) { + m_events += packContent; + } } #endif }