summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-07-25 05:11:00 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-07-25 05:20:30 +0200
commit6c1b7fd899f72136a1cc17eb9ae81746d8d98572 (patch)
treedd1807e6878b9fff29219f09b4aa7225b258f837 /scene/main
parent91bb4952e4f01d8a8fa729c2db2fb6beb5bce0ec (diff)
Fix Node::move_child() crash if moving to the end plus one
Fixes #9820.
Diffstat (limited to 'scene/main')
-rwxr-xr-xscene/main/node.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 26d1deadf9..c3849f79df 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -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