From 35463a12daff553bfcdc5e2de39231d88cd1f8fa Mon Sep 17 00:00:00 2001 From: Benau Date: Mon, 3 Feb 2020 00:48:16 +0800 Subject: [PATCH] Avoid possible infinite loop --- src/tracks/arena_graph.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tracks/arena_graph.cpp b/src/tracks/arena_graph.cpp index 0040ad6fa..ad43e18cd 100644 --- a/src/tracks/arena_graph.cpp +++ b/src/tracks/arena_graph.cpp @@ -317,6 +317,11 @@ void ArenaGraph::loadGoalNodes(const XMLNode *node) int last = Graph::UNKNOWN_SECTOR; findRoadSector(p2, &last, NULL, true); + // Avoid possible infinite loop + if (first == Graph::UNKNOWN_SECTOR || + last == Graph::UNKNOWN_SECTOR) + continue; + first_goal ? m_blue_node.insert(first) : m_red_node.insert(first); first_goal ? m_blue_node.insert(last) : m_red_node.insert(last); while (first != last)