Skip to content

Commit

Permalink
Fix crash in ClearCommand removing empty cels
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Aug 9, 2014
1 parent a6933b2 commit 7faf8a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/commands/cmd_clear.cpp
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion src/app/document_api.cpp
Expand Up @@ -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;

Expand Down

0 comments on commit 7faf8a1

Please sign in to comment.