fix: crashes when some shortcuts was set to nothing
This commit is contained in:
1 parent
484411040d
commit
9b3e4b180d
2 files changed
+7
-6
No files matched your search
@@ -54,7 +54,7 @@ class ATShortcut {
|
||||
return modifiers == (modifiers | shortcut.carbonModifierFlags)
|
||||
}
|
||||
let suffix = App.app.shortcutIndex == 0 ? "" : "2"
|
||||
let holdModifiers = ControlsTab.shortcuts["nextWindowShortcut" + suffix]!.shortcut.carbonModifierFlags
|
||||
let holdModifiers = ControlsTab.shortcuts["holdShortcut" + suffix]!.shortcut.carbonModifierFlags
|
||||
// contains exactly or exactly + holdShortcut modifiers
|
||||
return modifiers == shortcut.carbonModifierFlags || modifiers == (shortcut.carbonModifierFlags | holdModifiers)
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ class KeyRepeatTimer {
|
||||
static var isARepeat = false
|
||||
|
||||
static func toggleRepeatingKeyPreviousWindow() {
|
||||
let shortcut = ControlsTab.shortcuts["previousWindowShortcut"]!
|
||||
if shortcut.shortcut.keyCode == .none {
|
||||
if let shortcut = ControlsTab.shortcuts["previousWindowShortcut"],
|
||||
shortcut.shortcut.keyCode == .none {
|
||||
toggleRepeatingKey(shortcut) {
|
||||
App.app.previousWindowShortcutWithRepeatingKey()
|
||||
}
|
||||
@@ -16,9 +16,10 @@ class KeyRepeatTimer {
|
||||
|
||||
static func toggleRepeatingKeyNextWindow() {
|
||||
let suffix = App.app.shortcutIndex == 0 ? "" : "2"
|
||||
let shortcut = ControlsTab.shortcuts["nextWindowShortcut" + suffix]!
|
||||
toggleRepeatingKey(shortcut) {
|
||||
ControlsTab.shortcutsActions["nextWindowShortcut" + suffix]!()
|
||||
if let shortcut = ControlsTab.shortcuts["nextWindowShortcut" + suffix] {
|
||||
toggleRepeatingKey(shortcut) {
|
||||
ControlsTab.shortcutsActions["nextWindowShortcut" + suffix]!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user