From b97c26b1d2abb53d00c0c251e4bd5e3f9a59f72c Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sun, 25 Jan 2015 22:27:57 +0200 Subject: [PATCH] Avoid division by zero in assimp_cmd info when scene loading succeeds but contains no meshes --- tools/assimp_cmd/Info.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index a34129f31..055193f6e 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -112,12 +112,12 @@ unsigned int CountAnimChannels(const aiScene* scene) // ----------------------------------------------------------------------------------- unsigned int GetAvgFacePerMesh(const aiScene* scene) { - return static_cast(CountFaces(scene)/scene->mNumMeshes); + return (scene->mNumMeshes != 0) ? static_cast(CountFaces(scene)/scene->mNumMeshes) : 0; } // ----------------------------------------------------------------------------------- unsigned int GetAvgVertsPerMesh(const aiScene* scene) { - return static_cast(CountVertices(scene)/scene->mNumMeshes); + return (scene->mNumMeshes != 0) ? static_cast(CountVertices(scene)/scene->mNumMeshes) : 0; } // -----------------------------------------------------------------------------------