Skip to content

Commit

Permalink
Fix NPE when trying to call releaseCallback
Browse files Browse the repository at this point in the history
Fix #131
  • Loading branch information
MadLittleMods committed Dec 28, 2018
1 parent 921d415 commit 9f00e99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class IOHook extends EventEmitter {
/**
* Specify that key event's `rawcode` property should be used instead of
* `keycode` when listening for key presses.
*
*
* This allows iohook to be used in conjunction with other programs that may
* only provide a keycode.
* @param {Boolean} using
Expand Down Expand Up @@ -377,7 +377,9 @@ class IOHook extends EventEmitter {

if (shortcutReleased) {
// Call the released function handler
shortcut.releaseCallback(keysTmpArray);
if(shortcut.releaseCallback) {
shortcut.releaseCallback(keysTmpArray);
}

// Remove this shortcut from our activate shortcuts array
const index = this.activatedShortcuts.indexOf(shortcut);
Expand Down

0 comments on commit 9f00e99

Please sign in to comment.