commit 90bead86ed4b1e43d675b77a04ebe7cb4e674f7b
parent 221d1da34030992810e83021e394f3450f0f0894
Author: Simon Kornblith <simon@simonster.com>
Date: Sat, 2 Jun 2012 17:05:23 -0400
Don't cause problems if no callback passed to Zotero.Attachments methods
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js
@@ -220,7 +220,7 @@ Zotero.Attachments = new function(){
var urlRe = /^https?:\/\/[^\s]*$/;
var matches = urlRe.exec(url);
if (!matches) {
- callback(false);
+ if(callback) callback(false);
throw ("Invalid URL '" + url + "' in Zotero.Attachments.importFromURL()");
}
@@ -302,7 +302,7 @@ Zotero.Attachments = new function(){
+ "'application/pdf' in Attachments.importFromURL()";
Zotero.debug(errString, 2);
attachmentItem.erase();
- callback(false, new Error(errString));
+ if(callback) callback(false, new Error(errString));
return;
}
@@ -330,7 +330,7 @@ Zotero.Attachments = new function(){
catch (e) {
// Clean up
attachmentItem.erase();
- callback(false, e);
+ if(callback) callback(false, e);
throw (e);
}
@@ -616,7 +616,7 @@ Zotero.Attachments = new function(){
// Clean up
var item = Zotero.Items.get(itemID);
item.erase();
- callback(false, e);
+ if(callback) callback(false, e);
throw (e);
}