From 9f00e9988c5bdc191be584b5dde56fa408192178 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 28 Dec 2018 13:52:30 -0600 Subject: [PATCH] Fix NPE when trying to call releaseCallback Fix https://github.com/wilix-team/iohook/issues/131 --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index bee7d85c..e8214fea 100644 --- a/index.js +++ b/index.js @@ -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 @@ -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);