Skip to content

Commit

Permalink
NWN: Make sure we don't deref a nullptr in the WalkmeshLoader
Browse files Browse the repository at this point in the history
This fixes Coverity Scan issue #1399041.
  • Loading branch information
DrMcCoy committed Feb 25, 2019
1 parent 0e2f827 commit 658d1d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/engines/nwn/walkmeshloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ Common::AABBNode *WalkmeshLoader::buildAABBTree(std::vector<float> &vertices,
compatibility = compatTest;
}

if (!bestNode)
continue;

// Try to flatten the tree by pushing to the back the best node so at a following
// iteration it will not be choosen if another node has the same compatibility.
nodes.remove(bestNode);
Expand Down

0 comments on commit 658d1d3

Please sign in to comment.