diff --git a/CHANGELOG.md b/CHANGELOG.md index d1e23e16c..89af59c55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - API: - `annotations=true` now returns the data source id for each segment as `datasources` - Reduced semantic of merge to refer only to merges from a lane onto a motorway-like road + - Bugfixes + - Fixed an issue that would result in segfaults for viaroutes with an invalid intermediate segment when u-turns were allowed at the via-location # 5.3.0 Changes from 5.3.0-rc.3 diff --git a/features/testbot/via.feature b/features/testbot/via.feature index 8e3580db1..fdc212655 100644 --- a/features/testbot/via.feature +++ b/features/testbot/via.feature @@ -277,3 +277,20 @@ Feature: Via points When I route I should get | from | to | route | | e | f | ebbdcf,ebbdcf | + + @2798 + Scenario: UTurns Enabled + Given the node map + | a | b | c | d | e | + + And the query options + | continue_straight | false | + + And the ways + | nodes | oneway | + | abc | yes | + | edc | yes | + + When I route I should get + | waypoints | route | + | a,b,e | | diff --git a/include/engine/routing_algorithms/shortest_path.hpp b/include/engine/routing_algorithms/shortest_path.hpp index 5d52dc934..c0a338b19 100644 --- a/include/engine/routing_algorithms/shortest_path.hpp +++ b/include/engine/routing_algorithms/shortest_path.hpp @@ -114,7 +114,11 @@ class ShortestPathRouting final needs_loop_forwad, needs_loop_backwards); } - new_total_distance += std::min(total_distance_to_forward, total_distance_to_reverse); + // if no route is found between two parts of the via-route, the entire route becomes + // invalid. Adding to invalid edge weight sadly doesn't return an invalid edge weight. Here + // we prevent the possible overflow, faking the addition of infinity + x == infinity + if (new_total_distance != INVALID_EDGE_WEIGHT) + new_total_distance += std::min(total_distance_to_forward, total_distance_to_reverse); } // searches shortest path between: