www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 5d32e800fc38fc167486c0845ca6d701450a723e
parent 11e337a1893488dcaa636430cd9efb5fdd42839e
Author: Simon Kornblith <simon@simonster.com>
Date:   Tue, 14 Jun 2011 21:24:29 +0000

don't try to call callback if it doesn't exist


Diffstat:
Mchrome/content/zotero/xpcom/connector/connector.js | 20+++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/chrome/content/zotero/xpcom/connector/connector.js b/chrome/content/zotero/xpcom/connector/connector.js @@ -173,22 +173,20 @@ Zotero.Connector = new function() { Zotero.HTTP.doPost(CONNECTOR_URI+"connector/"+method, JSON.stringify(data), function(req) { _checkState(req.status != 0, function() { - if(!callback) callback(false); + if(!callback) return; if(Zotero.Connector.EXCEPTION_CODES.indexOf(req.status) !== -1) { - if(callback) callback(false, req.status); + callback(false, req.status); } else { - if(callback) { - var val = undefined; - if(req.responseText) { - if(req.getResponseHeader("Content-Type") === "application/json") { - val = JSON.parse(req.responseText); - } else { - val = req.responseText; - } + var val = null; + if(req.responseText) { + if(req.getResponseHeader("Content-Type") === "application/json") { + val = JSON.parse(req.responseText); + } else { + val = req.responseText; } - callback(val, req.status); } + callback(val, req.status); } }); }, {"Content-Type":"application/json"});