From 7efb94580f47e6663fc2058d17eb2e76ae8d4833 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Fri, 26 Apr 2013 16:49:24 +0200 Subject: [PATCH] - LWO: fix crash when computing normals for meshes that contain line or point faces. Thanks to Thomas Sevaldrud for the patch. --- code/LWOLoader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index 8e848e30e..5898eb8f6 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -467,6 +467,10 @@ void LWOImporter::ComputeNormals(aiMesh* mesh, const std::vector& for (; begin != end; ++begin) { aiFace& face = *begin; + if(face.mNumIndices < 3) { + continue; + } + // LWO doc: "the normal is defined as the cross product of the first and last edges" aiVector3D* pV1 = mesh->mVertices + face.mIndices[0]; aiVector3D* pV2 = mesh->mVertices + face.mIndices[1];