mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00: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
|
@ -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 a new issue