浏览代码

RemoveRedundantMaterials: Set pointer to nullptr after deleting it

Turo Lamminen 8 年之前
父节点
当前提交
266e3b29a8
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      code/RemoveRedundantMaterials.cpp

+ 2 - 0
code/RemoveRedundantMaterials.cpp

@@ -145,6 +145,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
             if (!abReferenced[i]) {
                 ++unreferencedRemoved;
                 delete pScene->mMaterials[i];
+                pScene->mMaterials[i] = nullptr;
                 continue;
             }
 
@@ -158,6 +159,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
                     me = 0;
                     aiMappingTable[i] = aiMappingTable[a];
                     delete pScene->mMaterials[i];
+                    pScene->mMaterials[i] = nullptr;
                     break;
                 }
             }