Fix crash pressing Shift+C on Home tab or when all sprites are closed

This commit is contained in:
David Capello 2016-09-14 16:04:20 -03:00
parent 5d0d609a3f
commit ada6c0666c

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -22,6 +22,7 @@ public:
Command* clone() const override { return new ScrollCenterCommand(*this); }
protected:
bool onEnabled(Context* context) override;
void onExecute(Context* context) override;
};
@ -32,6 +33,11 @@ ScrollCenterCommand::ScrollCenterCommand()
{
}
bool ScrollCenterCommand::onEnabled(Context* context)
{
return (current_editor != nullptr);
}
void ScrollCenterCommand::onExecute(Context* context)
{
current_editor->setDefaultScroll();