1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:47:35 +00:00

Applications: Do not crash if decoded bitmap is null

ImageViewer and PixelPaint would crash when the ImageDecoderClient
returns a frame without a bitmap. This can happen with `.ico` files
with an unsupported BPP, for example.
This commit is contained in:
Jelle Raaijmakers 2022-03-22 12:11:01 +01:00 committed by Andreas Kling
parent 1db7c423db
commit d195972ec2
2 changed files with 10 additions and 1 deletions

View file

@ -176,6 +176,11 @@ void ViewWidget::load_from_file(const String& path)
m_decoded_image = decoded_image_or_error.release_value();
m_bitmap = m_decoded_image->frames[0].bitmap;
if (m_bitmap.is_null()) {
show_error();
return;
}
set_original_rect(m_bitmap->rect());
if (on_image_change)
on_image_change(m_bitmap);