From 266e3b29a85fb56665df51775b6b08443bb6fdad Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 17 Oct 2017 19:48:08 +0300 Subject: [PATCH] RemoveRedundantMaterials: Set pointer to nullptr after deleting it --- code/RemoveRedundantMaterials.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/RemoveRedundantMaterials.cpp b/code/RemoveRedundantMaterials.cpp index 154bf63ca..8ea699f3d 100644 --- a/code/RemoveRedundantMaterials.cpp +++ b/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; } }