fix: prevent crash when sending a debug profile
This commit is contained in:
1 parent
6426d318fb
commit
741e7902db
1 file changed
+8
-5
@@ -106,11 +106,14 @@ class DebugProfile {
|
||||
}
|
||||
|
||||
static func inputSource() -> String {
|
||||
if let inputSource = TISCopyCurrentKeyboardInputSource()?.takeUnretainedValue(),
|
||||
let localizedNamePointer = TISGetInputSourceProperty(inputSource, kTISPropertyLocalizedName) {
|
||||
let localizedName = Unmanaged<AnyObject>.fromOpaque(localizedNamePointer).takeUnretainedValue()
|
||||
return localizedName as? String ?? ""
|
||||
let r = DispatchQueue.main.sync {
|
||||
if let inputSource = TISCopyCurrentKeyboardInputSource()?.takeUnretainedValue(),
|
||||
let localizedNamePointer = TISGetInputSourceProperty(inputSource, kTISPropertyLocalizedName) {
|
||||
let localizedName = Unmanaged<AnyObject>.fromOpaque(localizedNamePointer).takeUnretainedValue()
|
||||
return localizedName as? String ?? ""
|
||||
}
|
||||
return ""
|
||||
}
|
||||
return ""
|
||||
return r
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user