From d5b126caf2103be7cd1217a67ddbc80fc8895f1e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 17 Jul 2007 06:34:37 +0000 Subject: [PATCH] Fixes #674, Saved search referencing a deleted saved search cannot be deleted --- chrome/content/zotero/xpcom/collectionTreeView.js | 14 +++++++++++++- chrome/content/zotero/xpcom/data_access.js | 13 ++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index c7fd1a6ee..ba7b61949 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -883,7 +883,19 @@ Zotero.ItemGroup.prototype.getName = function() Zotero.ItemGroup.prototype.getChildItems = function() { var s = this.getSearchObject(); - var ids = s.search(); + try { + var ids = s.search(); + } + catch (e) { + if (e.match(/Saved search [0-9]+ does not exist/)) { + Zotero.DB.rollbackTransaction(); + Zotero.debug(e, 2); + return false; + } + else { + throw (e); + } + } return Zotero.Items.get(ids); } diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index 6d7369c37..fb37106fb 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -3695,7 +3695,18 @@ Zotero.Tags = new function(){ */ function getAllWithinSearch(search, types) { // Save search results to temporary table - var tmpTable = search.search(true); + try { + var tmpTable = search.search(true); + } + catch (e) { + if (e.match(/Saved search [0-9]+ does not exist/)) { + Zotero.DB.rollbackTransaction(); + Zotero.debug(e, 2); + } + else { + throw (e); + } + } if (!tmpTable) { return {}; }