mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #3662 from trentxintong/unicodescalar
SE-0128 - Change unicodescalar initializer to failable
This commit is contained in:
@@ -60,7 +60,7 @@ func nthUnicodeScalar(_ n: UInt32) -> UnicodeScalar {
|
||||
for r in unicodeScalarRanges {
|
||||
count += r.upperBound - r.lowerBound
|
||||
if count > n {
|
||||
return UnicodeScalar(r.upperBound - (count - n))
|
||||
return UnicodeScalar(r.upperBound - (count - n))!
|
||||
}
|
||||
}
|
||||
_preconditionFailure("Index out of range")
|
||||
|
||||
Reference in New Issue
Block a user