From 2cd347f4fa174fc71d04ca93f7a7a7d60f68af40 Mon Sep 17 00:00:00 2001 From: Andrea Catania Date: Fri, 23 Jul 2021 11:54:22 +0200 Subject: Fix GLTF crash when the material is not set. Sometimes there are meshes that doesn't have materials, so make sure to check this case before extracting the name. --- modules/gltf/gltf_document.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 09bae884b9..30d023606f 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -2796,7 +2796,7 @@ Error GLTFDocument::_parse_meshes(Ref 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 blend_weights; -- cgit v1.2.3