From c3f0686fd15d3817ce9a1e6aafd348bd992eb229 Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Mon, 5 Oct 2020 21:24:47 +0900 Subject: [PATCH] fix: crash on blacklisted app with main shortcut cleared --- src/logic/events/KeyboardEvents.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/logic/events/KeyboardEvents.swift b/src/logic/events/KeyboardEvents.swift index 5a974945..b888d771 100644 --- a/src/logic/events/KeyboardEvents.swift +++ b/src/logic/events/KeyboardEvents.swift @@ -55,8 +55,9 @@ class KeyboardEvents { if shouldDisable != App.app.globalShortcutsAreDisabled { let fn = shouldDisable ? unregisterHotKeyIfNeeded : registerHotKeyIfNeeded for shortcutId in globalShortcutsIds.keys { - let shortcut = ControlsTab.shortcuts[shortcutId]!.shortcut - fn(shortcutId, shortcut) + if let shortcut = ControlsTab.shortcuts[shortcutId]?.shortcut { + fn(shortcutId, shortcut) + } } debugPrint("toggleGlobalShortcuts", shouldDisable) App.app.globalShortcutsAreDisabled = shouldDisable