From 32aebd388b5506009bd764c1756438beb48e4337 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 26 Mar 2018 04:48:32 -0400 Subject: [PATCH] Fix upgrade error in c96363746b if no related items --- chrome/content/zotero/xpcom/schema.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 6a67bf2f51..51261d0366 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -2416,8 +2416,8 @@ Zotero.Schema = new function(){ else if (i == 100) { let userID = yield Zotero.DB.valueQueryAsync("SELECT value FROM settings WHERE setting='account' AND key='userID'"); - if (userID) { - let predicateID = yield Zotero.DB.valueQueryAsync("SELECT predicateID FROM relationPredicates WHERE predicate='dc:relation'"); + let predicateID = yield Zotero.DB.valueQueryAsync("SELECT predicateID FROM relationPredicates WHERE predicate='dc:relation'"); + if (userID && predicateID) { let rows = yield Zotero.DB.queryAsync("SELECT itemID, object FROM items JOIN itemRelations IR USING (itemID) WHERE libraryID=? AND predicateID=?", [1, predicateID]); for (let row of rows) { let matches = row.object.match(/^http:\/\/zotero.org\/users\/(\d+)\/items\/([A-Z0-9]+)$/);