Skip to content

Commit

Permalink
Protect against crash when collection is removed during empty-trash
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Mar 2, 2017
1 parent 2dbf0e2 commit 48aeb99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chrome/content/zotero/xpcom/data/collection.js
Expand Up @@ -640,7 +640,11 @@ Zotero.Collection.prototype._eraseData = Zotero.Promise.coroutine(function* (env
let deletedCollections = new Set(env.deletedObjectIDs);
itemsToUpdate.forEach(itemID => {
let item = Zotero.Items.get(itemID);
item._collections = item._collections.filter(c => !deletedCollections.has(c));
// XXX Condition protects against crash when collection is removed
// XXX while empty-trash operation is in progress.
if (item._collections) {
item._collections = item._collections.filter(c => !deletedCollections.has(c));
}
});
}
});
Expand Down

0 comments on commit 48aeb99

Please sign in to comment.