From f93ee9daced8e77227bdeba50fffd5e596eabe99 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 12 May 2018 08:10:26 +0200 Subject: [PATCH] closes https://github.com/assimp/assimp/issues/1780: check against nullptr before accessing normal data in aiMesh instance. --- code/glTF2Exporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index 5376788b2..9bb99b0b0 100644 --- a/code/glTF2Exporter.cpp +++ b/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 n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);