summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorCaoimhe <caoimhebyrne06@gmail.com>2023-03-23 18:38:22 +0000
committerSam Atkins <atkinssj@gmail.com>2023-03-23 18:45:51 +0000
commitac5f4792a8a7ce65f3f316b15ba6ef1b24539831 (patch)
tree2c04578f69e38557c4a707c0b8b455f9ad88886d /Userland
parent34224c42efe0933abe469b01ce63fea0f534923c (diff)
downloadserenity-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.cpp3
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);
}