Handle possible NULL-pointers for paths when rehashing the route
This commit is contained in:
parent
50c39a52bb
commit
b12da0e421
@ -254,6 +254,14 @@ int dijkstra_search_route_to_geojson(struct dijkstra_search *search,
|
||||
if (node_last) {
|
||||
path_to_this = search->states[node_last->uid]->cheapest_path;
|
||||
path_to_next = search->states[node->uid]->cheapest_path;
|
||||
if (!path_to_next) {
|
||||
report(LL_CRITICAL, "INTERNAL ERROR: path_to_next is NULL");
|
||||
break;
|
||||
}
|
||||
if (!path_to_this) {
|
||||
// This happens at the very beginning.
|
||||
path_to_this = path_to_next; // Pretend we were already where we started.
|
||||
}
|
||||
|
||||
heading = atan2f((node->position.y - node_last->position.y), (node->position.x - node_last->position.x)) / (M_PI * 2) * 360;
|
||||
if (heading < 0.0)
|
||||
|
Loading…
Reference in New Issue
Block a user