From d5bf5c912074db8ac6fc29b43dbd35114c1f3ebb Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 1 Sep 2008 17:59:25 +0000 Subject: [PATCH] Fixes #1157, Adding an existing tag to an item with no tags breaks Zotero --- chrome/content/zotero/xpcom/data/item.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 19aef341b..36d053c0d 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -2664,8 +2664,8 @@ Zotero.Item.prototype.addTag = function(name, type) { Zotero.DB.beginTransaction(); var matchingTags = Zotero.Tags.getIDs(name); - if (matchingTags) { - var itemTags = this.getTags(); + var itemTags = this.getTags(); + if (matchingTags && itemTags) { for each(var id in matchingTags) { if (itemTags.indexOf(id) != -1) { var tag = Zotero.Tags.get(id);