Selaa lähdekoodia

closes https://github.com/assimp/assimp/issues/1780: check against nullptr before accessing normal data in aiMesh instance.

Kim Kulling 7 vuotta sitten
vanhempi
commit
f93ee9dace
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      code/glTF2Exporter.cpp

+ 4 - 2
code/glTF2Exporter.cpp

@@ -728,8 +728,10 @@ void glTF2Exporter::ExportMeshes()
 
 		/******************** Normals ********************/
         // Normalize all normals as the validator can emit a warning otherwise
-        for (auto i = 0u; i < aim->mNumVertices; ++i) {
-            aim->mNormals[i].Normalize();
+        if ( nullptr != aim->mNormals) {
+            for ( auto i = 0u; i < aim->mNumVertices; ++i ) {
+                aim->mNormals[ i ].Normalize();
+            }
         }
 
 		Ref<Accessor> n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);