Refactor logic which checks for too large allocations

It's now easier to change the limit
This commit is contained in:
Turo Lamminen
2015-08-13 13:01:49 +03:00
parent 5575a54466
commit 0b0ba2ec4d
4 changed files with 15 additions and 5 deletions

View File

@@ -382,7 +382,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
pMesh->mNumVertices = numIndices;
if (pMesh->mNumVertices == 0) {
throw DeadlyImportError( "OBJ: no vertices" );
} else if (pMesh->mNumVertices > std::numeric_limits<int32_t>::max() / sizeof(aiVector3D)) {
} else if (pMesh->mNumVertices > AI_MAX_ALLOC(aiVector3D)) {
throw DeadlyImportError( "OBJ: Too many vertices, would run out of memory" );
}
pMesh->mVertices = new aiVector3D[ pMesh->mNumVertices ];