Skip to content

Commit c240fca

Browse files
committed
Off-by-one error in precondition:
for index <= position, if bytes.count == 0 and index == position, then we don't want this condition to be true at all.
1 parent d76486d commit c240fca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/Foundation/DispatchData+DataProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extension DispatchData : DataProtocol {
3434
}
3535

3636
public subscript(position: DispatchData.Index) -> UInt8 {
37-
precondition(index <= position && position <= index + bytes.count)
37+
precondition(index <= position && position < index + bytes.count)
3838
return bytes[position - index]
3939
}
4040

0 commit comments

Comments
 (0)