Skip to content

Commit 65aa2cc

Browse files
committed
core: stdcm: avoid infinite loop in logger edge case
Signed-off-by: Eloi Charpentier <[email protected]>
1 parent f4e0c84 commit 65aa2cc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/main/kotlin/fr/sncf/osrd/stdcm/ProgressLogger.kt

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ data class ProgressLogger(
2929
seenSteps++
3030
val progress =
3131
(graph.bestPossibleTime - node.remainingTimeEstimation) / graph.bestPossibleTime
32+
if (progress.isInfinite()) {
33+
// Sometimes happens when departure and destination have some overlapping points.
34+
// Would cause infinite loops if we process normally.
35+
return
36+
}
3237
if (progress >= thresholdDistance * nSamplesReached) {
3338
val block = node.infraExplorer.getCurrentBlock()
3439
val geo = makePathProps(graph.blockInfra, graph.rawInfra, block).getGeo().points[0]

0 commit comments

Comments
 (0)