From a304a6b28e29d90d5539da432c1c373e89e918bb Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 9 Mar 2015 15:23:07 +0000 Subject: [PATCH] Avoid occasional 'TypeError: Cannot read property '0' of null' error from aborted JSON when debugging. --- phpgwapi/js/jsapi/egw_json.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpgwapi/js/jsapi/egw_json.js b/phpgwapi/js/jsapi/egw_json.js index 9e3e2ae6a3..28ab207e2c 100644 --- a/phpgwapi/js/jsapi/egw_json.js +++ b/phpgwapi/js/jsapi/egw_json.js @@ -114,7 +114,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) { this.egw.message.call(this.egw, this.egw.lang('Ajax request failed')+': '+_xmlhttp.statusText+' ('+_xmlhttp.status+ ")\n\n"+this.egw.lang('Server error log should contain more information about the problem.')+ "\n"+this.egw.lang('Trying it again will usually not help!')+ - "\n\nURL: "+this.url+"\n"+_xmlhttp.getAllResponseHeaders().match(/^Date:.*$/m)[0]); + "\n\nURL: "+this.url+"\n"+(_xmlhttp.getAllResponseHeaders() ? _xmlhttp.getAllResponseHeaders().match(/^Date:.*$/m)[0]:'')); this.egw.debug('error', 'Ajax request to', this.url, ' failed: ', _err, _xmlhttp.status, _xmlhttp.statusText); }