summaryrefslogtreecommitdiffstats
path: root/editor/plugins/bone_map_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/bone_map_editor_plugin.cpp')
-rw-r--r--editor/plugins/bone_map_editor_plugin.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp
index 015dfdbca5..32ff478c33 100644
--- a/editor/plugins/bone_map_editor_plugin.cpp
+++ b/editor/plugins/bone_map_editor_plugin.cpp
@@ -1229,9 +1229,11 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
picklist.push_back("face");
int head = search_bone_by_name(skeleton, picklist, BONE_SEGREGATION_NONE, neck);
if (head == -1) {
- search_path = skeleton->get_bone_children(neck);
- if (search_path.size() == 1) {
- head = search_path[0]; // Maybe only one child of the Neck is Head.
+ if (neck != -1) {
+ search_path = skeleton->get_bone_children(neck);
+ if (search_path.size() == 1) {
+ head = search_path[0]; // Maybe only one child of the Neck is Head.
+ }
}
}
if (head == -1) {