Explorar o código

Merge pull request #7 from migenius/migenius-rsws52

Add check for NULL texcoord values.
ardenpm %!s(int64=6) %!d(string=hai) anos
pai
achega
fd75e4923c
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      code/glTF2Importer.cpp

+ 6 - 0
code/glTF2Importer.cpp

@@ -439,6 +439,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");