1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

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.
This commit is contained in:
Caoimhe 2023-03-23 18:38:22 +00:00 committed by Sam Atkins
parent 34224c42ef
commit ac5f4792a8

View file

@ -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);
}