Fix. Return from isSafe, we want to stop iterating when final result is clear.
This commit is contained in:
parent
f6425f1d56
commit
8f577f0c64
1 changed files with 1 additions and 1 deletions
|
@ -28,6 +28,6 @@ private fun isSafe(report: List<Int>): Boolean {
|
||||||
|
|
||||||
return report.fold(State()) { state, next ->
|
return report.fold(State()) { state, next ->
|
||||||
state.update(next)
|
state.update(next)
|
||||||
.also { if (!it.safe) return@fold it }
|
.also { if (!it.safe) return@isSafe false }
|
||||||
}.safe
|
}.safe
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue