A* Pathfinding Project

Bug in FloodPath.cs


#1

Hello!

I think I found a bug in the FoodPath class in the 4.1.19 beta version.

A return statement is missing here:

(Before fix) FloodPath.cs line 165
// Any nodes left to search?
if (pathHandler.heap.isEmpty) {
CompleteState = PathCompleteState.Complete;
}

currentR = pathHandler.heap.Remove();

(After fix) FloodPath.cs line 165
// Any nodes left to search?
if (pathHandler.heap.isEmpty) {
CompleteState = PathCompleteState.Complete;
return;
}

currentR = pathHandler.heap.Remove();


#2

Thanks for the bug report! That would indeed throw an exception when starting on a node that wasn’t connected to anything.