From f63caf894e8cd5eee6dbfe0fd4c25895ec5ffdcd Mon Sep 17 00:00:00 2001 From: Paul Arden Date: Thu, 6 Dec 2018 12:56:02 +1100 Subject: [PATCH] Add check for NULL texcoord values. --- code/glTF2Importer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/glTF2Importer.cpp b/code/glTF2Importer.cpp index 740935601..34f8cfcee 100755 --- a/code/glTF2Importer.cpp +++ b/code/glTF2Importer.cpp @@ -437,6 +437,12 @@ void glTF2Importer::ImportMeshes(glTF2::Asset& r) } for (size_t tc = 0; tc < attr.texcoord.size() && tc < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++tc) { + if (!attr.texcoord[tc]) { + DefaultLogger::get()->warn("NULL texcoord encountered in mesh \"" + mesh.name + + "\" and will be ignored"); + continue; + } + if (attr.texcoord[tc]->count != aim->mNumVertices) { DefaultLogger::get()->warn("Texcoord stream size in mesh \"" + mesh.name + "\" does not match the vertex count");