summaryrefslogtreecommitdiffstats
path: root/priv
diff options
context:
space:
mode:
authorEd Barwani <[email protected]>2013-08-07 11:08:35 +1000
committerEd Barwani <[email protected]>2013-08-07 11:08:35 +1000
commitcc6aa9a2e4d036c24895bbf7a8dfb92bb400df90 (patch)
tree16cfadea98e9d6082065f13c0869f98533a6fa62 /priv
parent6da53d366c164ad000d926b73699a3507a1c0eb3 (diff)
downloadbullet-cc6aa9a2e4d036c24895bbf7a8dfb92bb400df90.tar.gz
bullet-cc6aa9a2e4d036c24895bbf7a8dfb92bb400df90.tar.bz2
bullet-cc6aa9a2e4d036c24895bbf7a8dfb92bb400df90.zip
When polling check if data is defined
Prevent a javascript error that could stop polling. This happens when a request returns a 204 No Content. jQuery success callback has no data in this case causing an error.
Diffstat (limited to 'priv')
-rw-r--r--priv/bullet.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/priv/bullet.js b/priv/bullet.js
index 7cc9fb5..26a1fc5 100644
--- a/priv/bullet.js
+++ b/priv/bullet.js
@@ -59,7 +59,7 @@
contentType: 'application/x-www-form-urlencoded; charset=utf-8',
headers: {'X-Socket-Transport': 'xhrPolling'},
success: function(data){
- if (data.length !== 0){
+ if (data && data.length !== 0){
self.onmessage({'data': data});
}
}
@@ -181,7 +181,7 @@
fake.onopen(fake);
}
// Connection might have closed without a response body
- if (data.length !== 0){
+ if (data && data.length !== 0){
fake.onmessage({'data': data});
}
if (fake.readyState == OPEN){