From 2d632339e031fe0609e930c91d826119c69f85d4 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 9 May 2016 15:53:55 -0300 Subject: [PATCH] Fix crash creating a new brush from an empty cel using right-click --- src/app/commands/cmd_new_brush.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/commands/cmd_new_brush.cpp b/src/app/commands/cmd_new_brush.cpp index 70286bb35..a69b5bf7f 100644 --- a/src/app/commands/cmd_new_brush.cpp +++ b/src/app/commands/cmd_new_brush.cpp @@ -115,9 +115,11 @@ void NewBrushCommand::onQuickboxEnd(Editor* editor, const gfx::Rect& rect, ui::M if (buttons & ui::kButtonRight) { try { ContextWriter writer(UIContext::instance(), 250); - Transaction transaction(writer.context(), "Clear"); - transaction.execute(new cmd::ClearRect(writer.cel(), rect)); - transaction.commit(); + if (writer.cel()) { + Transaction transaction(writer.context(), "Clear"); + transaction.execute(new cmd::ClearRect(writer.cel(), rect)); + transaction.commit(); + } } catch (const std::exception& ex) { Console::showException(ex);