mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +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:
committed by
Andreas Kling
parent
1db7c423db
commit
d195972ec2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user