commit 551c8a36a7d2017c74c8aaf83d674f8588f32505 parent 505d3e6ac76f2375404da7d0f00f6f12cf363f43 Author: Dan Stillman <dstillman@zotero.org> Date: Tue, 17 Mar 2009 08:23:45 +0000 Fix upgrade error "counts[0] is undefined" (or "counts[1]") Diffstat:
| M | chrome/content/zotero/xpcom/schema.js | | | 8 | ++++++-- |
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js @@ -1725,9 +1725,13 @@ Zotero.Schema = new function(){ continue; } - // Use most frequent var counts = Zotero.DB.query("SELECT tag, COUNT(*) AS numItems FROM tags NATURAL JOIN itemTags WHERE tag LIKE ? GROUP BY tag ORDER BY numItems DESC", l); - if (counts[0].numItems != counts[1].numItems) { + // If not associated with any items, use all lowercase + if (!counts) { + var newTag = l; + } + // Use most frequent + else if (counts[0].numItems != counts[1].numItems) { var newTag = counts[0].tag; } // Use earliest