Skip to content

Commit

Permalink
Merge pull request #136 from MadLittleMods/fix-131-release-callback-npe
Browse files Browse the repository at this point in the history
Fix NPE when trying to call releaseCallback
  • Loading branch information
Djiit authored Dec 28, 2018
2 parents 921d415 + 9f00e99 commit 3f9f243
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 3f9f243

Please sign in to comment.