diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-02-20 23:30:21 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-21 22:34:09 +0100 |
commit | 30842916254ed5981299d739b7a2003c97857763 (patch) | |
tree | ccf4f6099a97870cc64903d91a63633e87ad9eaa /Userland/Libraries/LibGUI/FileSystemModel.cpp | |
parent | e3c00c93ae99111bb96658de10de368c5b095ca4 (diff) | |
download | serenity-30842916254ed5981299d739b7a2003c97857763.zip |
LibGUI: Fix crash when previewing palette images
For example, navigating File Manager to a directory that contains a vaild BMP file that
uses a palette, this code would end up trying to create an indexed thumbnail.
However, Painter asserts that the thumbnail that we paint on is *not* indexed,
usually crashing File Manager.
Partially fixes #5299, as it now crashes somewhere else.
Diffstat (limited to 'Userland/Libraries/LibGUI/FileSystemModel.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/FileSystemModel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index f38bc0116b..4c8d7b08af 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -497,7 +497,7 @@ static RefPtr<Gfx::Bitmap> render_thumbnail(const StringView& path) double scale = min(32 / (double)png_bitmap->width(), 32 / (double)png_bitmap->height()); - auto thumbnail = Gfx::Bitmap::create(png_bitmap->format(), { 32, 32 }); + auto thumbnail = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, { 32, 32 }); Gfx::IntRect destination = Gfx::IntRect(0, 0, (int)(png_bitmap->width() * scale), (int)(png_bitmap->height() * scale)); destination.center_within(thumbnail->rect()); |