Check for invalid file icons
authorAndreas Rönnquist <gusnan@debian.org>
Tue, 3 Dec 2024 11:38:36 +0000 (12:38 +0100)
committerAndreas Rönnquist <gusnan@debian.org>
Tue, 3 Dec 2024 13:29:48 +0000 (14:29 +0100)
Should hopefully help with broken themes on Linux.

Fixes #872.

Gbp-Pq: Name 0002-Check-for-invalid-file-icons.patch

src/recent_files.cpp

index 395c5fddd7f17c87e095bbef1202fab8a95842f4..9edacd814a67f84b9a5bdc2372d50a1aea753dde 100644 (file)
@@ -172,12 +172,16 @@ private:
         wxLogNull nolog;
 
         wxIcon icon(fullname, wxBITMAP_TYPE_ICO, desiredSize, desiredSize);
+
         if (!icon.IsOk())
             icon.LoadFile(fullname, wxBITMAP_TYPE_ICO);
+
+        if (!icon.IsOk())
+            return wxNullBitmap;
 #ifndef __WXMSW__
         // There is no guarantee that the desired size given at icon construction
         // has been taken into account - only wxMSW seems to use it
-        if (icon.IsOk() && (icon.GetWidth() != desiredSize || icon.GetHeight() != desiredSize))
+        if (icon.GetWidth() != desiredSize || icon.GetHeight() != desiredSize)
         {
             wxImage image = icon.ConvertToImage();
             image.Rescale(desiredSize, desiredSize, wxIMAGE_QUALITY_HIGH);