From c5d048a98a750b68e2ddf488b0691cdc326e3fe8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Mon, 26 Jan 2015 12:38:30 +0200 Subject: [PATCH] Fix crash when 3DS file contains faces but no vertices --- code/3DSLoader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/3DSLoader.cpp b/code/3DSLoader.cpp index 4f5614a00..1f2235229 100644 --- a/code/3DSLoader.cpp +++ b/code/3DSLoader.cpp @@ -175,6 +175,10 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile, // file. for (std::vector::iterator i = mScene->mMeshes.begin(), end = mScene->mMeshes.end(); i != end;++i) { + if ((*i).mFaces.size() > 0 && (*i).mPositions.size() == 0) { + delete mScene; + throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile); + } CheckIndices(*i); MakeUnique (*i); ComputeNormalsWithSmoothingsGroups(*i);