Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,14 @@ public override Iterator<TSource> Take(int count)
{
if (_source is Iterator<TSource> iterator &&
iterator.GetCount(onlyIfCheap: true) is int count &&
count > _minIndexInclusive)
count >= 0)
{
if (count <= _minIndexInclusive)
{
found = false;
return default;
}

// If there's no upper bound, or if there are fewer items in the list
// than the upper bound allows, just return the last element of the list.
// Otherwise, get the element at the upper bound.
Expand Down
Loading