mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix crash calling PaletteSize without active sprite
This commit is contained in:
parent
56ae29a9b4
commit
bc824ed9e6
@ -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<int>("size");
|
||||
}
|
||||
|
||||
bool PaletteSizeCommand::onEnabled(Context* context)
|
||||
{
|
||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable);
|
||||
}
|
||||
|
||||
void PaletteSizeCommand::onExecute(Context* context)
|
||||
{
|
||||
ContextReader reader(context);
|
||||
|
Loading…
Reference in New Issue
Block a user