Gooong / LeastCostPath

The Least Cost Path Plugin for QGIS
https://plugins.qgis.org/plugins/leastcostpath/
GNU General Public License v3.0
24 stars 12 forks source link

dijsktra_algorithm.py - consider checking if feedback is None before using it #11

Closed sebbelese closed 1 year ago

sebbelese commented 2 years ago

I guess this is not relevant within the QGIS plugin, but the dijkstra function in deikstra_algorithm.py reads: def dijkstra(start_tuple, end_tuples, costMap, find_nearest=True, feedback=None): which means that feedback is optional.

However, there is a call to feedback in the function which does not check if feedback exists, resulting in an error if the function is called with the default arguments, e.g.: feedback.setProgress(1 + 100 * (1 - bound / total_manhattan))

It can be an issue if we call the function from a python script, not the QGIS plugin

Gooong commented 2 years ago

Hi,

Thanks for your feedback. Will fix this bug soon.

Gooong commented 1 year ago

Fixed. Will release soon.