Skip to content

Commit

Permalink
Check for invalid file icons
Browse files Browse the repository at this point in the history
Should hopefully help with broken themes on Linux.

Fixes #872.
  • Loading branch information
vslavik committed Dec 3, 2024
1 parent f9381ee commit d172814
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/recent_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d172814

Please sign in to comment.