Fixes #674, Saved search referencing a deleted saved search cannot be deleted

This commit is contained in:
Dan Stillman 2007-07-17 06:34:37 +00:00
parent 2af5590122
commit d5b126caf2
2 changed files with 25 additions and 2 deletions

View File

@ -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);
}

View File

@ -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 {};
}