2
0
Эх сурвалжийг харах

Update XFileParser.cpp

Fix exception.
Kim Kulling 6 жил өмнө
parent
commit
7e20356a20
1 өөрчлөгдсөн 11 нэмэгдсэн , 15 устгасан
  1. 11 15
      code/XFileParser.cpp

+ 11 - 15
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();