From 67de8ad477f816ea8c1fb62545ad9017b701efbf Mon Sep 17 00:00:00 2001 From: Carsten Neumann Date: Wed, 16 Nov 2022 10:18:57 -0500 Subject: [PATCH] Fixes unchecked access of primitives.targets --- Scripts/Spec/GLTFMesh.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/Spec/GLTFMesh.cs b/Scripts/Spec/GLTFMesh.cs index 79c7448..c0de408 100644 --- a/Scripts/Spec/GLTFMesh.cs +++ b/Scripts/Spec/GLTFMesh.cs @@ -199,7 +199,7 @@ public MeshData(GLTFMesh gltfMesh, GLTFAccessor.ImportResult[] accessors, GLTFBu bool hasTargetNames = gltfMesh.extras != null && gltfMesh.extras.targetNames != null; if (hasTargetNames) { - if (gltfMesh.primitives.All(x => x.targets.Count != gltfMesh.extras.targetNames.Length)) { + if (gltfMesh.primitives.All(x => x.targets == null || x.targets.Count != gltfMesh.extras.targetNames.Length)) { Debug.LogWarning("Morph target names found in mesh " + name + " but array length does not match primitive morph target array length"); hasTargetNames = false; }