Fix crash deleting a group layer at the top level

The crash could be achieved by having just one group layer at the top
level (with some children) and trying to delete it using Layer >
Delete Layer menu option (without using the timeline range).

Report: https://igarastudio.zendesk.com/agent/tickets/1719
This commit is contained in:
Gaspar Capello 2021-01-15 16:40:48 -03:00 committed by David Capello
parent 32106512dc
commit 3035a5713d

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -78,7 +78,7 @@ void RemoveLayerCommand::onExecute(Context* context)
}
}
else {
if (sprite->allLayersCount() == 1) {
if (sprite->root()->layersCount() == 1) {
ui::Alert::show(Strings::alerts_cannot_delete_all_layers());
return;
}