From 734b4a46bcb69cdd45e1e285badbdd9a3beb4bcd Mon Sep 17 00:00:00 2001 From: jitspoe Date: Mon, 22 Nov 2021 22:44:30 -0500 Subject: [PATCH] Fix crash when exporting gltf mesh that has no skin. (cherry picked from commit 209ac9569c4c5180aea4b330ed7f6d2a572d5e82) --- modules/gltf/gltf_document.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 049f0bfe1be..8e369525466 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -6068,7 +6068,10 @@ void GLTFDocument::_convert_mesh_instances(Ref state) { int bone_cnt = skeleton->get_bone_count(); ERR_FAIL_COND(bone_cnt != gltf_skeleton->joints.size()); - ObjectID gltf_skin_key = skin->get_instance_id(); + ObjectID gltf_skin_key = 0; + if (skin.is_valid()) { + gltf_skin_key = skin->get_instance_id(); + } ObjectID gltf_skel_key = godot_skeleton->get_instance_id(); GLTFSkinIndex skin_gltf_i = -1; GLTFNodeIndex root_gltf_i = -1;