From b2e38d4f6b1ef7d921957d70dbb6b96b804ded8f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andreas=20R=C3=B6nnquist?= Date: Tue, 3 Dec 2024 12:38:36 +0100 Subject: [PATCH] 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 --- src/recent_files.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.30.2