summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-01-31 10:32:22 +0100
committerGitHub <noreply@github.com>2019-01-31 10:32:22 +0100
commit6225b17d5f51f936c4f00c5f7d2f3e9f3328ec96 (patch)
tree0087bc6083e86ae49af9678f841811d93c82a9fd
parentc21ca98e4c6e6228adefcc696b3ff6a1104c678e (diff)
parente34a4c63a70ac69703523f9d0b835929b3ba4a0d (diff)
Merge pull request #25493 from bojidar-bg/21601-astar-segfault
Fix AStar crashing with large (>1e30) estimated values
-rw-r--r--core/math/a_star.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index a0556ae839..b885a06834 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -260,8 +260,8 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
}
// Check open list
- SelfList<Point> *least_cost_point = NULL;
- real_t least_cost = 1e30;
+ SelfList<Point> *least_cost_point = open_list.first();
+ real_t least_cost = Math_INF;
// TODO: Cache previous results
for (SelfList<Point> *E = open_list.first(); E; E = E->next()) {