Skip to content

Commit 92c7c15

Browse files
Fix percentiles array extension out of range index bug.
1 parent f03f816 commit 92c7c15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/web3swift/Convenience/Array+Extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extension Array where Element: BinaryInteger {
4949
let index = Int(ceil(normalizedValue))
5050

5151
let sorted_data = self.sorted()
52-
guard index < self.count else { return sorted_data[sorted_data.endIndex] }
52+
guard index < self.count else { return sorted_data[sorted_data.count - 1] }
5353
return sorted_data[index]
5454
}
5555
}

0 commit comments

Comments
 (0)