diff --git a/chrome/content/zotero/xpcom/undoHistory.js b/chrome/content/zotero/xpcom/undoHistory.js index 172a544210..66fcfadab4 100644 --- a/chrome/content/zotero/xpcom/undoHistory.js +++ b/chrome/content/zotero/xpcom/undoHistory.js @@ -168,7 +168,10 @@ Zotero.UndoHistory = { } catch (e) { Zotero.logError('UndoHistory: undo failed: ' + e); - // Entry is lost -- don't push to redo + // A failure means the object drifted out from under our snapshots, + // so the rest of the stack can't be trusted either. Discard history + // rather than risk applying stale values. + this.clear(); } return true; }, @@ -202,7 +205,10 @@ Zotero.UndoHistory = { } catch (e) { Zotero.logError('UndoHistory: redo failed: ' + e); - // Entry is lost -- don't push to undo + // A failure means the object drifted out from under our snapshots, + // so the rest of the stack can't be trusted either. Discard history + // rather than risk applying stale values. + this.clear(); } return true; },