Fix crash trying to move an empty cel with Move tool

This commit is contained in:
David Capello 2015-04-30 17:26:46 -03:00
parent 91bacca270
commit 20120f432a
2 changed files with 5 additions and 0 deletions

View File

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

View File

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