Browse Source

Merge pull request #50764 from AndreaCatania/AndreaCatania-patch-4

Fix GLTF crash when the material is not set.
Rémi Verschelde 4 years ago
parent
commit
78dae32247
1 changed files with 1 additions and 1 deletions
  1. 1 1
      modules/gltf/gltf_document.cpp

+ 1 - 1
modules/gltf/gltf_document.cpp

@@ -2796,7 +2796,7 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> state) {
 				mat = mat3d;
 			}
 
-			import_mesh->add_surface(primitive, array, morphs, Dictionary(), mat, mat->get_name());
+			import_mesh->add_surface(primitive, array, morphs, Dictionary(), mat, mat.is_valid() ? mat->get_name() : String());
 		}
 
 		Vector<float> blend_weights;