From a7fccf8f3352bc3e20689a46d4a8d0ce30384cb8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 7 Nov 2017 18:18:01 +0200 Subject: [PATCH] OptimizeGraph: Fix possible null pointer dereference --- code/OptimizeGraph.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/OptimizeGraph.cpp b/code/OptimizeGraph.cpp index 04971af5e..0e510e5ea 100644 --- a/code/OptimizeGraph.cpp +++ b/code/OptimizeGraph.cpp @@ -233,11 +233,13 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list& no nd->mNumChildren = static_cast(child_nodes.size()); + if (nd->mChildren) { aiNode** tmp = nd->mChildren; for (std::list::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) { aiNode* node = *tmp++ = *it; node->mParent = nd; } + } nodes_out += static_cast(child_nodes.size()); }