Fix Node::move_child() crash if moving to the end plus one

Fixes #9820.
This commit is contained in:
Pedro J. Estébanez 2017-07-25 05:11:00 +02:00
parent 91bb4952e4
commit 6c1b7fd899

View file

@ -311,6 +311,11 @@ void Node::move_child(Node *p_child, int p_pos) {
ERR_FAIL_COND(data.blocked > 0);
}
// Specifying one place beyond the end
// means the same as moving to the last position
if (p_pos == data.children.size())
p_pos--;
if (p_child->data.pos == p_pos)
return; //do nothing