diff options
author | Caoimhe <caoimhebyrne06@gmail.com> | 2023-03-23 18:38:22 +0000 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-03-23 18:45:51 +0000 |
commit | ac5f4792a8a7ce65f3f316b15ba6ef1b24539831 (patch) | |
tree | 2c04578f69e38557c4a707c0b8b455f9ad88886d /Userland | |
parent | 34224c42efe0933abe469b01ce63fea0f534923c (diff) | |
download | serenity-ac5f4792a8a7ce65f3f316b15ba6ef1b24539831.zip |
ImageViewer: Fix crash when opening ImageViewer without an image
Seems like a thing which slipped through the cracks... We shouldn't try
to scale the image to the window's size if the bitmap doesn't exist.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/ImageViewer/ViewWidget.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index a3dca258b5..61818e6d22 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -221,6 +221,9 @@ void ViewWidget::resize_event(GUI::ResizeEvent& event) void ViewWidget::scale_image_for_window() { + if (!m_bitmap) + return; + set_original_rect(m_bitmap->rect()); fit_content_to_view(GUI::AbstractZoomPanWidget::FitType::Both); } |