Răsfoiți Sursa

aiMesh: fix copy constructor so issue [3572335] (and any further instances of the same pattern in creating face arrays) is resolved.

Alexander Gessler 12 ani în urmă
părinte
comite
c016198191
1 a modificat fișierele cu 7 adăugiri și 2 ștergeri
  1. 7 2
      include/assimp/mesh.h

+ 7 - 2
include/assimp/mesh.h

@@ -160,8 +160,13 @@ struct aiFace
 
 		delete[] mIndices;
 		mNumIndices = o.mNumIndices;
-		mIndices = new unsigned int[mNumIndices];
-		::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));
+		if (mNumIndices) {
+			mIndices = new unsigned int[mNumIndices];
+			::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));
+		}
+		else {
+			mIndices = NULL;
+		}
 		return *this;
 	}