mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27: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:
parent
1db7c423db
commit
d195972ec2
2 changed files with 10 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue