From 20120f432a3682658bd9c46da9a4597cfeb54eab Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 30 Apr 2015 17:26:46 -0300 Subject: [PATCH] Fix crash trying to move an empty cel with Move tool --- src/app/ui/editor/moving_cel_state.cpp | 1 + src/app/ui/editor/standby_state.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/app/ui/editor/moving_cel_state.cpp b/src/app/ui/editor/moving_cel_state.cpp index b9b0bd2ef..9b0eaa38c 100644 --- a/src/app/ui/editor/moving_cel_state.cpp +++ b/src/app/ui/editor/moving_cel_state.cpp @@ -40,6 +40,7 @@ MovingCelState::MovingCelState(Editor* editor, MouseMessage* msg) ASSERT(layer->isImage()); m_cel = layer->cel(editor->frame()); + ASSERT(m_cel); // The cel cannot be null if (m_cel) { m_celStart = m_cel->position(); } diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index 2a191e7c4..28dab32aa 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -189,6 +189,10 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg) StatusBar::instance()->showTip(1000, "Layer '%s' is locked", layer->name().c_str()); } + else if (!layer->cel(editor->frame())) { + StatusBar::instance()->showTip(1000, + "Cel is empty, nothing to move"); + } else { // Change to MovingCelState editor->setState(EditorStatePtr(new MovingCelState(editor, msg)));