Skip to content

Commit 17c19fb

Browse files
committed
[stdlib] fix an indexing inconsistency
This iteration ranged from `buffer.startIndex` to `buffer.count`, rather than to `buffer.endIndex`. Using `buffer.indices` is a better solution in any case.
1 parent 4aed3d1 commit 17c19fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/Sequence.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ extension Sequence {
11501150
) -> (Iterator, UnsafeMutableBufferPointer<Element>.Index) {
11511151
var it = self.makeIterator()
11521152
guard var ptr = buffer.baseAddress else { return (it, buffer.startIndex) }
1153-
for idx in buffer.startIndex..<buffer.count {
1153+
for idx in buffer.indices {
11541154
guard let x = it.next() else {
11551155
return (it, idx)
11561156
}

0 commit comments

Comments
 (0)