aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-05-02 15:44:28 +0200
committerpiernov <piernov@piernov.org>2016-05-02 15:44:28 +0200
commitb60d56327a1b8531d15348034889e67f8b49444d (patch)
tree98db7f91f102d5576b1c6c5b04bd1f3371497eb2
parent29a1138f7d0c0e3b5ca785aef381bae96d282777 (diff)
downloadcandybox-b60d56327a1b8531d15348034889e67f8b49444d.tar.gz
candybox-b60d56327a1b8531d15348034889e67f8b49444d.tar.bz2
candybox-b60d56327a1b8531d15348034889e67f8b49444d.tar.xz
candybox-b60d56327a1b8531d15348034889e67f8b49444d.zip
Allow empty data from server
-rw-r--r--js/craftmine.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/js/craftmine.js b/js/craftmine.js
index 8af8296..608efb7 100644
--- a/js/craftmine.js
+++ b/js/craftmine.js
@@ -11,7 +11,8 @@ function sendRequest(url, params, callback) {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == "200") {
- var data = JSON.parse(xhr.responseText);
+ var data = "";
+ if(xhr.responseText) data = JSON.parse(xhr.responseText);
if(data.info)
showInfo(data.info);
if(data.error) {