diff --git a/lib/http-api.js b/lib/http-api.js index e192dfa91..09b3d4d38 100644 --- a/lib/http-api.js +++ b/lib/http-api.js @@ -111,6 +111,11 @@ module.exports.MatrixHttpApi.prototype = { case global.XMLHttpRequest.DONE: clearTimeout(xhr.timeout_timer); + if (!xhr.responseText) { + cb(new Error('No response body.')); + return; + } + var resp = JSON.parse(xhr.responseText); if (resp.content_uri === undefined) { cb(new Error('Bad response'));