From 90e92c0b66f653b9ef3fc07873f782ae5260ad0b Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Wed, 23 Sep 2020 00:12:42 +0200 Subject: [PATCH] Ensure mousetrap instance exists in unbindShortcut (cherry picked from commit 930742ae2c69a530afe60f76a5824f2722540df8) --- frontend/src/Components/keyboardShortcuts.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/Components/keyboardShortcuts.js b/frontend/src/Components/keyboardShortcuts.js index 713f2bff4..b576a988c 100644 --- a/frontend/src/Components/keyboardShortcuts.js +++ b/frontend/src/Components/keyboardShortcuts.js @@ -67,8 +67,10 @@ function keyboardShortcuts(WrappedComponent) { }; unbindShortcut = (key) => { - delete this._mousetrapBindings[key]; - this._mousetrap.unbind(key); + if (this._mousetrap != null) { + delete this._mousetrapBindings[key]; + this._mousetrap.unbind(key); + } }; unbindAllShortcuts = () => {