OFFLoader: Throw error on certain invalid files instead of failing validation later

pull/675/head
Turo Lamminen 2015-10-28 14:20:13 +02:00
parent 7a5bc6eca3
commit 9825d07764
1 changed files with 3 additions and 0 deletions

View File

@ -225,6 +225,9 @@ void OFFImporter::InternReadFile( const std::string& pFile,
++faces; ++faces;
} }
if (mesh->mNumVertices != verts.size()) {
throw DeadlyImportError("OFF: Vertex count mismatch");
}
mesh->mVertices = new aiVector3D[verts.size()]; mesh->mVertices = new aiVector3D[verts.size()];
memcpy(mesh->mVertices, &verts[0], verts.size() * sizeof(aiVector3D)); memcpy(mesh->mVertices, &verts[0], verts.size() * sizeof(aiVector3D));
// generate the output node graph // generate the output node graph