mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
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.
This commit is contained in:
parent
ef54a3c0d2
commit
3112a6b44f
Notes:
sideshowbarker
2024-07-17 21:16:31 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/3112a6b44f Pull-request: https://github.com/SerenityOS/serenity/pull/17657
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user