fixed Inf case

dijkstra can return Inf, breaks max.