summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Catania <info@andreacatania.com>2021-07-23 11:54:22 +0200
committerGitHub <noreply@github.com>2021-07-23 11:54:22 +0200
commit2cd347f4fa174fc71d04ca93f7a7a7d60f68af40 (patch)
treed5844b226aab56dc4119eb7c7e3cded1bf9cd3d8
parent515670351a5b8d13eef475df9d602e846f53884d (diff)
downloadredot-engine-2cd347f4fa174fc71d04ca93f7a7a7d60f68af40.tar.gz
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.cpp2
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;