fix: avoid crashing on uncommon keys in shortcuts (closes #4379)

This commit is contained in:
lwouis committed 2025-03-31 12:09:04 +02:00
1 parent 17e1f1e4c7
commit 9d852eee9c
1 file changed
+4 -2
@@ -193,11 +193,13 @@ class ControlsTab {
}
} else {
let newValue = combineHoldAndNextWindow(controlId, sender)
if newValue.isEmpty {
let newShortcut = Shortcut(keyEquivalent: newValue)
if newValue.isEmpty || newShortcut == nil {
removeShortcutIfExists(controlId)
restrictModifiersOfHoldShortcut(controlId, [])
(sender as! CustomRecorderControl).objectValue = nil
} else {
addShortcut(.down, controlId.hasPrefix("nextWindowShortcut") ? .global : .local, Shortcut(keyEquivalent: newValue)!, controlId, nil)
addShortcut(.down, controlId.hasPrefix("nextWindowShortcut") ? .global : .local, newShortcut!, controlId, nil)
restrictModifiersOfHoldShortcut(controlId, [(sender as! CustomRecorderControl).objectValue!.modifierFlags])
}
}