KT-31639: Fix Iterables.drop integer overflow
This commit is contained in:
committed by
Ilya Gorbunov
parent
e5565b817b
commit
c885cadde4
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user