diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-02-27 23:33:35 +0000 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-02-28 08:37:10 +0000 |
commit | 3112a6b44f42cb3198cad247c6e3a0dcbd4ba796 (patch) | |
tree | b94cbf4f572f84656a0fb95b219bebf7521e6653 | |
parent | ef54a3c0d22e30dc6df47a6d28341d13f4357daa (diff) | |
download | serenity-3112a6b44f42cb3198cad247c6e3a0dcbd4ba796.zip |
PixelPaint: Fix clicking on the layer menu with no image loaded
Previously, clicking on the layer menu with no image loaded would
cause a crash.
-rw-r--r-- | Userland/Applications/PixelPaint/MainWidget.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index d0e5c53d01..57911fa649 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -691,7 +691,8 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window) if (!visible) return; - bool image_has_selection = !current_image_editor()->active_layer()->image().selection().is_empty(); + auto* editor = current_image_editor(); + bool image_has_selection = editor && editor->active_layer() && !editor->active_layer()->image().selection().is_empty(); m_layer_via_copy->set_enabled(image_has_selection); m_layer_via_cut->set_enabled(image_has_selection); |