[Pkg-javascript-commits] [sockjs-client] 40/350: Fixes #143 by checking for empty response

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:03:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.

commit 6249821d8a078a671e5a92e6e7ba927404a834b2
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Wed May 7 11:32:47 2014 -0400

    Fixes #143 by checking for empty response
    
    Also try/catch JSON.parse for an error.
---
 lib/info.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/info.js b/lib/info.js
index 1597884..fc5b662 100644
--- a/lib/info.js
+++ b/lib/info.js
@@ -26,7 +26,13 @@ InfoReceiver.prototype.doXhr = function(base_url, AjaxObject) {
         tref = null;
         if (status === 200) {
             var rtt = (new Date()).getTime() - t0;
-            var info = JSON.parse(text);
+            var info;
+            if (text) {
+                try {
+                    info = JSON.parse(text);
+                }
+                catch (e) {}
+            }
             if (typeof info !== 'object') info = {};
             that.emit('finish', info, rtt);
         } else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list