summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorlaws65 <seanes118@gmail.com>2021-09-23 11:30:45 +0930
committerlaws65 <seanes118@gmail.com>2021-09-23 11:30:45 +0930
commit59ff3fda7f2331719f83ce8970681bb62f8ac40f (patch)
treec5358877a3bbb02dc78635a57af0fdf493be87a9 /scene/3d
parentbfcc29635f92d5054de1acc0a51561638b28570b (diff)
Prevent being able to set bone's parent as itself
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/skeleton_3d.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 0f5de621ea..b7a79a2645 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -520,6 +520,7 @@ void Skeleton3D::set_bone_parent(int p_bone, int p_parent) {
const int bone_size = bones.size();
ERR_FAIL_INDEX(p_bone, bone_size);
ERR_FAIL_COND(p_parent != -1 && (p_parent < 0));
+ ERR_FAIL_COND(p_bone == p_parent);
bones.write[p_bone].parent = p_parent;
process_order_dirty = true;