From 2a582638ec89e021ce146dcd30f9a978edb5c110 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 28 Jan 2015 11:04:07 -0300 Subject: [PATCH] Fix crash trying to move pixels and the current layer is nullptr This fix was found thanks to a user provided memory dump. We don't know why the layer can be nullptr, but there are some conditions preventing this situation already in other places of the StandbyState::onMouseDown() member function. --- src/app/ui/editor/standby_state.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index d8fd49cb9..205de71c7 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -243,7 +243,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg) if (handle != NoHandle) { int x, y, opacity; Image* image = location.image(&x, &y, &opacity); - if (image) { + if (layer && image) { if (!layer->isWritable()) { StatusBar::instance()->showTip(1000, "Layer '%s' is locked", layer->name().c_str()); @@ -258,7 +258,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg) } // Move selected pixels - if (editor->isInsideSelection() && msg->left()) { + if (layer && editor->isInsideSelection() && msg->left()) { if (!layer->isWritable()) { StatusBar::instance()->showTip(1000, "Layer '%s' is locked", layer->name().c_str());