diff --git a/src/display/editor/tools.js b/src/display/editor/tools.js index ee8ce1a60..977bb53fd 100644 --- a/src/display/editor/tools.js +++ b/src/display/editor/tools.js @@ -1680,6 +1680,7 @@ class AnnotationEditorUIManager { } this.#updateModeCapability = Promise.withResolvers(); + this.#currentDrawingSession?.commitOrRemove(); this.#mode = mode; if (mode === AnnotationEditorType.NONE) { diff --git a/src/display/touch_manager.js b/src/display/touch_manager.js index 421325b14..08de46001 100644 --- a/src/display/touch_manager.js +++ b/src/display/touch_manager.js @@ -215,9 +215,12 @@ class TouchManager { if (evt.touches.length >= 2) { return; } - this.#touchMoveAC.abort(); - this.#touchMoveAC = null; - this.#onPinchEnd?.(); + // #touchMoveAC shouldn't be null but it seems that irl it can (see #19793). + if (this.#touchMoveAC) { + this.#touchMoveAC.abort(); + this.#touchMoveAC = null; + this.#onPinchEnd?.(); + } if (!this.#touchInfo) { return;