From d1728143657d9f15d12746ed6a4ab7ec09dd9cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Tue, 3 Dec 2024 11:48:29 +0100 Subject: [PATCH] Check for invalid file icons Should hopefully help with broken themes on Linux. Fixes #872. --- 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 395c5fddd7..1cb8fc9a22 100644 --- a/src/recent_files.cpp +++ b/src/recent_files.cpp @@ -174,10 +174,14 @@ class file_icons 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);