From bc824ed9e69c2809e5f5d451c10915d34d7867de Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 20 May 2021 17:31:08 -0300 Subject: [PATCH] Fix crash calling PaletteSize without active sprite --- src/app/commands/cmd_palette_size.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/commands/cmd_palette_size.cpp b/src/app/commands/cmd_palette_size.cpp index ff6fb21cb..753be9012 100644 --- a/src/app/commands/cmd_palette_size.cpp +++ b/src/app/commands/cmd_palette_size.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2021 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -30,6 +30,7 @@ public: protected: void onLoadParams(const Params& params) override; + bool onEnabled(Context* context) override; void onExecute(Context* context) override; private: @@ -47,6 +48,11 @@ void PaletteSizeCommand::onLoadParams(const Params& params) m_size = params.get_as("size"); } +bool PaletteSizeCommand::onEnabled(Context* context) +{ + return context->checkFlags(ContextFlags::ActiveDocumentIsWritable); +} + void PaletteSizeCommand::onExecute(Context* context) { ContextReader reader(context);