From c358f8f8ee76785d3a5516cc7a51f12b2644a492 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 10 Aug 2022 10:42:14 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/5607 --- app/src/protyle/undo/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/undo/index.ts b/app/src/protyle/undo/index.ts index 46591d70a..3a7f10e36 100644 --- a/app/src/protyle/undo/index.ts +++ b/app/src/protyle/undo/index.ts @@ -64,7 +64,9 @@ class Undo { } public replace(doOperations: IOperation[]) { - this.undoStack[this.undoStack.length - 1].doOperations = doOperations; + if (this.undoStack.length > 0) { + this.undoStack[this.undoStack.length - 1].doOperations = doOperations; + } } public add( doOperations: IOperation[], undoOperations: IOperation[]) {