Merge pull request #9833 from RandomShaper/fix-node-crash

Fix Node::move_child() crash if moving to the end plus one
This commit is contained in:
Rémi Verschelde 2017-07-25 08:12:21 +02:00 committed by GitHub
commit 5a251d0d5c
1 changed files with 5 additions and 0 deletions

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