From c01619819182752e4d98e48d816d13d2a0a3a0b3 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 21 Mar 2013 20:17:09 +0100 Subject: [PATCH] aiMesh: fix copy constructor so issue [3572335] (and any further instances of the same pattern in creating face arrays) is resolved. --- include/assimp/mesh.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/assimp/mesh.h b/include/assimp/mesh.h index 26084c77e..df257e7f1 100644 --- a/include/assimp/mesh.h +++ b/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; }