Skip to content

Commit

Permalink
add null check for hotkey system
Browse files Browse the repository at this point in the history
this guards against a failed dlopen()
  • Loading branch information
DarkRTA committed Jan 20, 2021
1 parent 577cfc4 commit 2b21dad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/chronos.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ int main(int argc, char *argv[])

SharedTimer_drop(stimer);
Layout_drop(layout);
HotkeySystem_drop(hotkey_system);
if (hotkey_system != NULL)
HotkeySystem_drop(hotkey_system);
command_free(&cmd);
}

Expand All @@ -111,9 +112,11 @@ static inline int process_hotkey(
HotkeySystemRefMut hotkey_system)
{
if (key == CONFIG.local_hk.hks_enable)
HotkeySystem_activate(hotkey_system);
if (hotkey_system != NULL)
HotkeySystem_activate(hotkey_system);
if (key == CONFIG.local_hk.hks_disable)
HotkeySystem_deactivate(hotkey_system);
if (hotkey_system != NULL)
HotkeySystem_deactivate(hotkey_system);
if (key == CONFIG.local_hk.split)
Timer_split_or_start(timer);
if (key == CONFIG.local_hk.reset)
Expand Down

0 comments on commit 2b21dad

Please sign in to comment.