From: Andreas Rönnquist Date: Tue, 3 Dec 2024 11:38:36 +0000 (+0100) Subject: Check for invalid file icons X-Git-Tag: archive/raspbian/3.5.2-2+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b2e38d4f6b1ef7d921957d70dbb6b96b804ded8f;p=poedit.git Check for invalid file icons Should hopefully help with broken themes on Linux. Fixes #872. Gbp-Pq: Name 0002-Check-for-invalid-file-icons.patch --- diff --git a/src/recent_files.cpp b/src/recent_files.cpp index 395c5fd..9edacd8 100644 --- a/src/recent_files.cpp +++ b/src/recent_files.cpp @@ -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);