Skip to content

Commit 1ee2083

Browse files
committed
fix: create sessions for empty app bundle identifiers
Closes #977
1 parent 9e477f0 commit 1ee2083

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sources/SquirrelInputController.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import InputMethodKit
99

1010
final class SquirrelInputController: IMKInputController {
1111
private static let keyRollOver = 50
12+
private static var unknownAppCnt: UInt = 0
1213

1314
private weak var client: IMKTextInput?
1415
private let rimeAPI: RimeApi_stdbool = rime_get_api_stdbool().pointee
@@ -332,7 +333,10 @@ private extension SquirrelInputController {
332333
}
333334

334335
func createSession() {
335-
guard let app = client?.bundleIdentifier() else { return }
336+
let app = client?.bundleIdentifier() ?? {
337+
SquirrelInputController.unknownAppCnt &+= 1
338+
return "UnknownApp\(SquirrelInputController.unknownAppCnt)"
339+
}()
336340
print("createSession: \(app)")
337341
currentApp = app
338342
session = rimeAPI.create_session()

0 commit comments

Comments
 (0)