From fb92ae8ae5ea994d7a9f2250747b124532c9eea6 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 24 Jul 2011 10:13:34 -0700 Subject: [PATCH] guard --- 4chan_x.user.js | 8 ++++++-- script.coffee | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9a8cde8b1..87377ccf5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -730,7 +730,9 @@ if (((_ref = e.target.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) { return; } - key = keybinds.cb.keyCode(e); + if (!(key = keybinds.cb.keyCode(e))) { + return; + } thread = nav.getThread(); switch (key) { case conf.close: @@ -1126,7 +1128,9 @@ keybind: function(e) { e.preventDefault(); e.stopPropagation(); - key = keybinds.cb.keyCode(e); + if (!(key = keybinds.cb.keyCode(e))) { + return; + } this.value = key; $.setValue(this.name, key); return conf[this.name] = key; diff --git a/script.coffee b/script.coffee index d5b6edfd5..60782e9c9 100644 --- a/script.coffee +++ b/script.coffee @@ -520,7 +520,7 @@ keybinds = cb: keydown: (e) -> return if e.target.nodeName in ['TEXTAREA', 'INPUT'] and not e.altKey and not e.ctrlKey and not (e.keyCode is 27) - key = keybinds.cb.keyCode e + return unless key = keybinds.cb.keyCode e thread = nav.getThread() switch key @@ -891,7 +891,7 @@ options = keybind: (e) -> e.preventDefault() e.stopPropagation() - key = keybinds.cb.keyCode e + return unless key = keybinds.cb.keyCode e @value = key $.setValue @name, key conf[@name] = key