Skip to content

Commit c7feef6

Browse files
authored
Merge pull request #16393 from itaiferber/localizedString-for-nullability-fix
Correct cast from IUO in Locale.localizedString(for:)
2 parents 7641aa7 + 6fa5555 commit c7feef6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/SDK/Foundation/Locale.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public struct Locale : Hashable, Equatable, ReferenceConvertible {
109109
/// For example, in the "en" locale, the result for `.buddhist` is `"Buddhist Calendar"`.
110110
public func localizedString(for calendarIdentifier: Calendar.Identifier) -> String? {
111111
// NSLocale doesn't export a constant for this
112-
let result = CFLocaleCopyDisplayNameForPropertyValue(unsafeBitCast(_wrapped, to: CFLocale.self), .calendarIdentifier, Calendar._toNSCalendarIdentifier(calendarIdentifier).rawValue as CFString) as String
112+
let result = CFLocaleCopyDisplayNameForPropertyValue(unsafeBitCast(_wrapped, to: CFLocale.self), .calendarIdentifier, Calendar._toNSCalendarIdentifier(calendarIdentifier).rawValue as CFString) as String?
113113
return result
114114
}
115115

0 commit comments

Comments
 (0)