diff options
author | mvglasow <michael -at- vonglasow.com> | 2018-12-19 22:48:20 +0100 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2018-12-19 22:48:20 +0100 |
commit | cd50bea50c57815251996a6c7046d61b03e4be14 (patch) | |
tree | 552cc5a095f77e365fa2a1177a5c6e6a7210e2b5 | |
parent | 7b0c1886b3c810cb9e1d21c6523be53caffef9e7 (diff) | |
download | navit-cd50bea50c57815251996a6c7046d61b03e4be14.tar.gz |
Add:traffic:Increase resilience for three-point locations
Signed-off-by: mvglasow <michael -at- vonglasow.com>
-rw-r--r-- | navit/traffic.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/navit/traffic.c b/navit/traffic.c index b192df33b..4fafa104d 100644 --- a/navit/traffic.c +++ b/navit/traffic.c @@ -2645,10 +2645,21 @@ static int traffic_message_add_segments(struct traffic_message * this_, struct m if (start_new) p_start = start_new; } - if (dir > 0) - traffic_route_flood_graph(rg, pcoords[1], pcoords[2], p_start); - else - traffic_route_flood_graph(rg, pcoords[1], pcoords[0], p_start); + if (dir > 0) { + if (!p_start) { + /* fallback if calculating the first piece of the route failed */ + p_start = traffic_route_flood_graph(rg, pcoords[1], pcoords[2], NULL); + start_new = traffic_route_prepend(rg, p_start); + } else + traffic_route_flood_graph(rg, pcoords[1], pcoords[2], p_start); + } else { + if (!p_start) { + /* fallback if calculating the first piece of the route failed */ + p_start = traffic_route_flood_graph(rg, pcoords[1], pcoords[0], NULL); + start_new = traffic_route_prepend(rg, p_start); + } else + traffic_route_flood_graph(rg, pcoords[1], pcoords[0], p_start); + } dbg(lvl_debug, "*****checkpoint ADD-4.1.2"); } |