Skip to content

Commit

Permalink
Fix a potential source for crashes on macOS when detecting layout dir…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
Jeehut committed Dec 13, 2024
1 parent ffc8780 commit b6ef799
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/TelemetryDeck/Signals/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ extension DefaultSignalPayload {
#if os(iOS) || os(tvOS)
return UIApplication.shared.userInterfaceLayoutDirection == .leftToRight ? "leftToRight" : "rightToLeft"
#elseif os(macOS)
return NSApp.userInterfaceLayoutDirection == .leftToRight ? "leftToRight" : "rightToLeft"
if let nsApp = NSApp {
return nsApp.userInterfaceLayoutDirection == .leftToRight ? "leftToRight" : "rightToLeft"
} else {
return "N/A"
}
#else
return "N/A"
#endif
Expand Down

0 comments on commit b6ef799

Please sign in to comment.