From f1e2cee91d3ea8a33beddd32b28bd2f418a5f792 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Fri, 5 Aug 2022 17:40:43 -0400 Subject: [PATCH] fix crash when importing glb (#1732) --- goalc/build_level/gltf_mesh_extract.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goalc/build_level/gltf_mesh_extract.cpp b/goalc/build_level/gltf_mesh_extract.cpp index ccad587db3..7ef450bd7c 100644 --- a/goalc/build_level/gltf_mesh_extract.cpp +++ b/goalc/build_level/gltf_mesh_extract.cpp @@ -529,7 +529,7 @@ void extract(const Input& in, const auto& mesh = model.meshes[node.mesh]; mesh_count++; for (const auto& prim : mesh.primitives) { - if (model.materials[prim.material].extras.Has("set_invisible") && + if (prim.material >= 0 && model.materials[prim.material].extras.Has("set_invisible") && model.materials[prim.material].extras.Get("set_invisible").Get()) { continue; }