Skip to content

Commit

Permalink
Fix truncate, do not MoveNext before we know we have enough elements
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed Dec 19, 2023
1 parent 163d61b commit ac58c65
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/FSharp.Control.TaskSeq/TaskSeqInternal.fs
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,12 @@ module internal TaskSeqInternal =
while cont do
yield e.Current
pos <- pos + 1
let! moveNext = e.MoveNextAsync()
cont <- moveNext && pos < count

if pos < count then
let! moveNext = e.MoveNextAsync()
cont <- moveNext
else
cont <- false

}

Expand Down

0 comments on commit ac58c65

Please sign in to comment.