Fix crash in ClearCommand removing empty cels

This commit is contained in:
David Capello 2014-08-09 11:25:40 -03:00
parent a6933b2c7a
commit 7faf8a1bb7
2 changed files with 7 additions and 1 deletions

View File

@ -78,6 +78,10 @@ void ClearCommand::onExecute(Context* context)
ContextWriter writer(context);
Document* document = writer.document();
bool visibleMask = document->isMaskVisible();
if (!writer.cel())
return;
{
UndoTransaction undoTransaction(writer.context(), "Clear");
DocumentApi api = document->getApi();

View File

@ -1097,8 +1097,10 @@ void DocumentApi::replaceStockImage(Sprite* sprite, int imageIndex, Image* newIm
// Clears the mask region in the current sprite with the specified background color.
void DocumentApi::clearMask(Layer* layer, Cel* cel, color_t bgcolor)
{
ASSERT(cel);
ASSERT(layer == cel->layer());
Image* image = cel->image();
Image* image = (cel ? cel->image(): NULL);
if (!image)
return;