From 40edcdee91ba7a1f940c8d783b780ae2c743764a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 24 Oct 2006 18:33:58 +0000 Subject: [PATCH] Error when adding a link or snapshot to the library (without a collection) --- chrome/content/zotero/xpcom/attachments.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index c8f086e66..e3fb24f68 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -270,10 +270,12 @@ Zotero.Attachments = new function(){ mimeType, charsetID, sourceItemID); // Add to collections - var ids = Zotero.flattenArguments(parentCollectionIDs); - for each(var id in ids){ - var col = Zotero.Collections.get(id); - col.addItem(itemID); + if (parentCollectionIDs){ + var ids = Zotero.flattenArguments(parentCollectionIDs); + for each(var id in ids){ + var col = Zotero.Collections.get(id); + col.addItem(itemID); + } } // Run the fulltext indexer asynchronously (actually, it hangs the UI @@ -339,10 +341,12 @@ Zotero.Attachments = new function(){ charsetID, sourceItemID, itemID); // Add to collections - var ids = Zotero.flattenArguments(parentCollectionIDs); - for each(var id in ids){ - var col = Zotero.Collections.get(id); - col.addItem(itemID); + if (parentCollectionIDs){ + var ids = Zotero.flattenArguments(parentCollectionIDs); + for each(var id in ids){ + var col = Zotero.Collections.get(id); + col.addItem(itemID); + } } Zotero.DB.commitTransaction();