Fix crash clicking "Hide Other Layers" when there is no preview window (fix #4768)

Clicking "View > Preview > Hide Other Layers" would try to access the
Preview editor when it's nullptr.
This commit is contained in:
David Capello 2024-11-06 09:00:29 -03:00
parent 0ace79f979
commit 5c62fd68de

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2023 Igara Studio S.A.
// Copyright (C) 2023-2024 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -87,7 +87,10 @@ void ToggleOtherLayersOpacityCommand::onExecute(Context* ctx)
if (params().preview()) {
PreviewEditorWindow* previewWin =
App::instance()->mainWindow()->getPreviewEditor();
previewWin->previewEditor()->invalidate();
if (previewWin &&
previewWin->previewEditor()) {
previewWin->previewEditor()->invalidate();
}
}
else {
app_refresh_screen();