From d1bacb53fd4a5c46b805af6eb7ccc93ff60bbafc Mon Sep 17 00:00:00 2001 From: laws65 Date: Tue, 21 Sep 2021 22:06:03 +0930 Subject: [PATCH] Prevent being able to set bone's parent as itself --- scene/3d/skeleton.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 1c3af648290..6dc025f4250 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -456,6 +456,7 @@ int Skeleton::get_bone_count() const { void Skeleton::set_bone_parent(int p_bone, int p_parent) { ERR_FAIL_INDEX(p_bone, bones.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;