Allow NULL as search destination to generate the entire tree

feature/trainlines-wip
Markus Koch 2020-05-03 00:09:05 +02:00
parent 7d6082ed68
commit 25a80f7fa9
1 changed files with 4 additions and 1 deletions

View File

@ -137,7 +137,7 @@ int dijkstra_search_find_path(struct dijkstra_search *search,
while (g_list_length(search->active_nodes) > 0) {
iteration++;
dijkstra_search_process_queue(search);
if (search->states[destination->uid]->visited)
if (destination && search->states[destination->uid]->visited)
return iteration;
if (iteration >= DIJKSTRA_SEARCH_MAX_ITERATIONS) {
report(LL_ERROR, "Exceeded maximum iteration limit for query.");
@ -145,6 +145,9 @@ int dijkstra_search_find_path(struct dijkstra_search *search,
}
}
if (!destination)
return iteration;
return -1;
}