KT-31639: Fix Iterables.drop integer overflow

This commit is contained in:
Eduard Wolf
2019-05-27 19:16:13 +02:00
committed by Ilya Gorbunov
parent e5565b817b
commit c885cadde4
3 changed files with 8 additions and 2 deletions
@@ -614,7 +614,7 @@ public fun <T> Iterable<T>.drop(n: Int): List<T> {
}
var count = 0
for (item in this) {
if (count++ >= n) list.add(item)
if (count >= n) list.add(item) else ++count
}
return list.optimizeReadOnlyList()
}