Avoid division by zero in assimp_cmd info when scene loading succeeds but contains no meshes

pull/445/head
Turo Lamminen 2015-01-25 22:27:57 +02:00
parent cc346d3e12
commit b97c26b1d2
1 changed files with 2 additions and 2 deletions

View File

@ -112,12 +112,12 @@ unsigned int CountAnimChannels(const aiScene* scene)
// -----------------------------------------------------------------------------------
unsigned int GetAvgFacePerMesh(const aiScene* scene) {
return static_cast<unsigned int>(CountFaces(scene)/scene->mNumMeshes);
return (scene->mNumMeshes != 0) ? static_cast<unsigned int>(CountFaces(scene)/scene->mNumMeshes) : 0;
}
// -----------------------------------------------------------------------------------
unsigned int GetAvgVertsPerMesh(const aiScene* scene) {
return static_cast<unsigned int>(CountVertices(scene)/scene->mNumMeshes);
return (scene->mNumMeshes != 0) ? static_cast<unsigned int>(CountVertices(scene)/scene->mNumMeshes) : 0;
}
// -----------------------------------------------------------------------------------