mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +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
1 changed files with 2 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue