From 7e20356a203b2c0a15aec2c479a6edecf286a0d3 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 10 Jun 2019 20:32:56 +0200 Subject: [PATCH] Update XFileParser.cpp Fix exception. --- code/XFileParser.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index caccc7fad..08d3c88da 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -594,23 +594,19 @@ void XFileParser::ParseDataObjectMeshNormals( Mesh* pMesh) } // do not crah when no face definitions are there - if (numFaces == 0) { - //TestForSeparator(); - CheckForClosingBrace(); - return; - } + if (numFaces > 0) { + // normal face creation + pMesh->mNormFaces.resize( pMesh->mNormFaces.size() + numFaces ); + for( unsigned int a = 0; a < numFaces; ++a ) { + unsigned int numIndices = ReadInt(); + pMesh->mNormFaces.push_back( Face() ); + Face& face = pMesh->mNormFaces.back(); + for( unsigned int b = 0; b < numIndices; ++b ) { + face.mIndices.push_back( ReadInt()); + } - // normal face creation - pMesh->mNormFaces.resize( pMesh->mNormFaces.size() + numFaces ); - for( unsigned int a = 0; a < numFaces; ++a ) { - unsigned int numIndices = ReadInt(); - pMesh->mNormFaces.push_back( Face() ); - Face& face = pMesh->mNormFaces.back(); - for( unsigned int b = 0; b < numIndices; ++b ) { - face.mIndices.push_back( ReadInt()); + TestForSeparator(); } - - TestForSeparator(); } CheckForClosingBrace();