Merge pull request #60435 from Scony/fix-map-get-path-crash-3.x

[3.x] Fix crash in `GodotNavigationServer::map_get_path`, fixes #60413
This commit is contained in:
Rémi Verschelde 2022-04-25 23:19:04 +02:00 committed by GitHub
commit d60e432575
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,10 +156,10 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
while (found_route == false) { while (found_route == false) {
{ {
gd::NavigationPoly *least_cost_poly = &navigation_polys[least_cost_id];
// Takes the current least_cost_poly neighbors and compute the traveled_distance of each // Takes the current least_cost_poly neighbors and compute the traveled_distance of each
for (size_t i = 0; i < navigation_polys[least_cost_id].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]; const gd::Edge &edge = least_cost_poly->poly->edges[i];
if (!edge.other_polygon) if (!edge.other_polygon)
continue; continue;