Skip to content

Commit 6fa5555

Browse files
author
Itai Ferber
committed
Fix a cast to an IUO which can actually be nil.
1 parent ae8718f commit 6fa5555

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)