Fix possible infinite when broken navmesh with separated nodes

This commit is contained in:
Benau 2021-02-26 11:55:16 +08:00
parent b05452a9c9
commit 3e0a651e01

View File

@ -329,6 +329,9 @@ void ArenaGraph::loadGoalNodes(const XMLNode *node)
// Find all the nodes which connect the two points of
// goal, notice: only work if it's a straight line
first = getNextNode(first, last);
// Happens when broken navmesh with separated nodes
if (first == Graph::UNKNOWN_SECTOR)
break;
first_goal ? m_blue_node.insert(first) :
m_red_node.insert(first);
}