From ad3e02f5ef376234b445fb2f0168be9ead651f97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Mon, 21 Nov 2022 09:26:55 -0500
Subject: [PATCH] misc: fix crash on invalid iterator

Change-Id: I7a5eb63fb2d6ad08e4826905e873bcbe95bf2a0b
GitLab: #860
---
 src/app/messagesadapter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/messagesadapter.cpp b/src/app/messagesadapter.cpp
index 7ae08d002..4fcf25d83 100644
--- a/src/app/messagesadapter.cpp
+++ b/src/app/messagesadapter.cpp
@@ -589,7 +589,7 @@ MessagesAdapter::isLocalImage(const QString& mimename)
                                      [fileFormat](QByteArray format) {
                                          return format == fileFormat;
                                      });
-        if (*iterator == "gif") {
+        if (iterator != supportedFormats.end() && *iterator == "gif") {
             return {{"isAnimatedImage", true}};
         }
         return {{"isImage", iterator != supportedFormats.end()}};
-- 
GitLab