Explorar o código

My mistake, fixed

bzt %!s(int64=5) %!d(string=hai) anos
pai
achega
2b252bb9a5
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      code/M3D/M3DImporter.cpp

+ 6 - 1
code/M3D/M3DImporter.cpp

@@ -396,9 +396,14 @@ void M3DImporter::importMeshes()
         // we must switch mesh if material changes
         // we must switch mesh if material changes
         if(lastMat != m3d->face[i].materialid) {
         if(lastMat != m3d->face[i].materialid) {
             lastMat = m3d->face[i].materialid;
             lastMat = m3d->face[i].materialid;
-            if(pMesh && vertices->size() && faces->size()) {
+            if(pMesh && vertices && vertices->size() && faces && faces->size()) {
                 populateMesh(pMesh, faces, vertices, normals, texcoords, colors, vertexids);
                 populateMesh(pMesh, faces, vertices, normals, texcoords, colors, vertexids);
                 meshes->push_back(pMesh);
                 meshes->push_back(pMesh);
+                delete faces;
+                delete vertices;
+                delete normals;
+                delete texcoords;
+                delete colors;
                 delete vertexids;   // this is not stored in pMesh, just to collect bone vertices
                 delete vertexids;   // this is not stored in pMesh, just to collect bone vertices
             }
             }
             pMesh = new aiMesh;
             pMesh = new aiMesh;