Browse Source

RemoveRedundantMaterials: Add assertion to silence a static analyzer warning

Turo Lamminen 8 years ago
parent
commit
c51b92cfa3
1 changed files with 1 additions and 0 deletions
  1. 1 0
      code/RemoveRedundantMaterials.cpp

+ 1 - 0
code/RemoveRedundantMaterials.cpp

@@ -171,6 +171,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
         // If the new material count differs from the original,
         // If the new material count differs from the original,
         // we need to rebuild the material list and remap mesh material indexes.
         // we need to rebuild the material list and remap mesh material indexes.
         if (iNewNum != pScene->mNumMaterials) {
         if (iNewNum != pScene->mNumMaterials) {
+            ai_assert(iNewNum > 0);
             aiMaterial** ppcMaterials = new aiMaterial*[iNewNum];
             aiMaterial** ppcMaterials = new aiMaterial*[iNewNum];
             ::memset(ppcMaterials,0,sizeof(void*)*iNewNum);
             ::memset(ppcMaterials,0,sizeof(void*)*iNewNum);
             for (unsigned int p = 0; p < pScene->mNumMaterials;++p)
             for (unsigned int p = 0; p < pScene->mNumMaterials;++p)