don't try to call callback if it doesn't exist
This commit is contained in:
parent
11e337a189
commit
5d32e800fc
|
@ -173,22 +173,20 @@ Zotero.Connector = new function() {
|
||||||
Zotero.HTTP.doPost(CONNECTOR_URI+"connector/"+method, JSON.stringify(data),
|
Zotero.HTTP.doPost(CONNECTOR_URI+"connector/"+method, JSON.stringify(data),
|
||||||
function(req) {
|
function(req) {
|
||||||
_checkState(req.status != 0, function() {
|
_checkState(req.status != 0, function() {
|
||||||
if(!callback) callback(false);
|
if(!callback) return;
|
||||||
|
|
||||||
if(Zotero.Connector.EXCEPTION_CODES.indexOf(req.status) !== -1) {
|
if(Zotero.Connector.EXCEPTION_CODES.indexOf(req.status) !== -1) {
|
||||||
if(callback) callback(false, req.status);
|
callback(false, req.status);
|
||||||
} else {
|
} else {
|
||||||
if(callback) {
|
var val = null;
|
||||||
var val = undefined;
|
if(req.responseText) {
|
||||||
if(req.responseText) {
|
if(req.getResponseHeader("Content-Type") === "application/json") {
|
||||||
if(req.getResponseHeader("Content-Type") === "application/json") {
|
val = JSON.parse(req.responseText);
|
||||||
val = JSON.parse(req.responseText);
|
} else {
|
||||||
} else {
|
val = req.responseText;
|
||||||
val = req.responseText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
callback(val, req.status);
|
|
||||||
}
|
}
|
||||||
|
callback(val, req.status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, {"Content-Type":"application/json"});
|
}, {"Content-Type":"application/json"});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user