diff options
author | Andrea Catania <info@andreacatania.com> | 2021-07-23 11:54:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-23 11:54:22 +0200 |
commit | 2cd347f4fa174fc71d04ca93f7a7a7d60f68af40 (patch) | |
tree | d5844b226aab56dc4119eb7c7e3cded1bf9cd3d8 | |
parent | 515670351a5b8d13eef475df9d602e846f53884d (diff) |
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.
-rw-r--r-- | modules/gltf/gltf_document.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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<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; |