Fix crash creating a new brush from an empty cel using right-click

This commit is contained in:
David Capello 2016-05-09 15:53:55 -03:00
parent 6a1a9556ae
commit 2d632339e0

View File

@ -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);