From 97c96086193986c8b85a4c1bb880a457959ff130 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 5 Sep 2011 16:28:52 -0700 Subject: [PATCH] guard --- 4chan_x.user.js | 4 ++-- script.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 7169fffe4..bf3323e52 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1524,8 +1524,8 @@ return $('textarea', QR.qr).value = ''; }, submit: function(e) { - var captcha, challenge, el, id, input, op, qr, response; - if (!($('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length)) { + var captcha, challenge, el, id, input, op, qr, response, _ref; + if (!($('textarea', QR.qr).value || ((_ref = $('[type=file]', QR.qr)) != null ? _ref.files.length : void 0))) { if (e) { alert('Error: No text entered.'); e.preventDefault(); diff --git a/script.coffee b/script.coffee index 77f7be3ae..6e1d73cb1 100644 --- a/script.coffee +++ b/script.coffee @@ -1177,7 +1177,7 @@ QR = $('textarea', QR.qr).value = '' submit: (e) -> #XXX e is undefined if method is called explicitly, eg, from auto posting - unless $('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length + unless $('textarea', QR.qr).value or $('[type=file]', QR.qr)?.files.length if e alert 'Error: No text entered.' e.preventDefault()