[graphics/drawy] src/widgets/mime: fix: don't create an empty image if dropping non-image file

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 40b2018480769bf197b5f3c8cdc47886dc4b2344 by Laurent Montel, on behalf of Nikolay Kochulin.
Committed on 06/08/2026 at 18:09.
Pushed by mlaurent into branch 'master'.

fix: don't create an empty image if dropping non-image file

M  +3    -1    src/widgets/mime/imagemimehandler.cpp

https://invent.kde.org/graphics/drawy/-/commit/40b2018480769bf197b5f3c8cdc47886dc4b2344

diff --git a/src/widgets/mime/imagemimehandler.cpp b/src/widgets/mime/imagemimehandler.cpp
index 45e0e399..0583e1b2 100644
--- a/src/widgets/mime/imagemimehandler.cpp
+++ b/src/widgets/mime/imagemimehandler.cpp
@@ -30,7 +30,9 @@ QList<std::shared_ptr<Item>> ImageMimeHandler::tryReadData(const QMimeData &mime
             return {};
         }
 
-        pixmap.load(url.toLocalFile());
+        if (!pixmap.load(url.toLocalFile())) {
+            return {};
+        }
     } else {
         return {};
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.