Skip to content

Commit e35637a

Browse files
Eduard Wolfqwwdfsad
Eduard Wolf
authored andcommitted
Fix overflow bug in Flow.drop
1 parent 218dc97 commit e35637a

File tree

1 file changed

+1
-1
lines changed
  • kotlinx-coroutines-core/common/src/flow/operators

1 file changed

+1
-1
lines changed

kotlinx-coroutines-core/common/src/flow/operators/Limit.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public fun <T> Flow<T>.drop(count: Int): Flow<T> {
2323
return flow {
2424
var skipped = 0
2525
collect { value ->
26-
if (++skipped > count) emit(value)
26+
if (skipped >= count) emit(value) else ++skipped
2727
}
2828
}
2929
}

0 commit comments

Comments
 (0)