summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-04-25 23:13:59 +0200
committerGitHub <noreply@github.com>2022-04-25 23:13:59 +0200
commitbc520e443d9cc35e1f336016dbe2214681f95130 (patch)
tree61dfb3b8433d8a30b0410e43b58287917f59415b
parentbef00b2b0d24f77cb125070113f8a50a7f895c00 (diff)
parent66856d5fb0b215a902a5dbf35091c56cc63fca1d (diff)
Merge pull request #60436 from Scony/fix-map-get-path-crash
Fix crash in `GodotNavigationServer::map_get_path`
-rw-r--r--modules/navigation/nav_map.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp
index 217e503d82..a6df6bb72c 100644
--- a/modules/navigation/nav_map.cpp
+++ b/modules/navigation/nav_map.cpp
@@ -142,10 +142,10 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
bool is_reachable = true;
while (true) {
- gd::NavigationPoly *least_cost_poly = &navigation_polys[least_cost_id];
-
// Takes the current least_cost_poly neighbors (iterating over its edges) and compute the traveled_distance.
- for (size_t i = 0; i < least_cost_poly->poly->edges.size(); i++) {
+ for (size_t i = 0; i < navigation_polys[least_cost_id].poly->edges.size(); i++) {
+ gd::NavigationPoly *least_cost_poly = &navigation_polys[least_cost_id];
+
const gd::Edge &edge = least_cost_poly->poly->edges[i];
// Iterate over connections in this edge, then compute the new optimized travel distance assigned to this polygon.