Parcourir la source

OptimizeGraph: Fix possible null pointer dereference

Turo Lamminen il y a 7 ans
Parent
commit
a7fccf8f33
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      code/OptimizeGraph.cpp

+ 2 - 0
code/OptimizeGraph.cpp

@@ -233,11 +233,13 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
 
     nd->mNumChildren = static_cast<unsigned int>(child_nodes.size());
 
+    if (nd->mChildren) {
     aiNode** tmp = nd->mChildren;
     for (std::list<aiNode*>::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) {
         aiNode* node = *tmp++ = *it;
         node->mParent = nd;
     }
+    }
 
     nodes_out += static_cast<unsigned int>(child_nodes.size());
 }