From 1f5021d76ac12f44e378ceac72b6333772e4edab Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 22 Aug 2020 18:09:17 +0200 Subject: [PATCH] Prevent errors if `PDFDocumentProxy.saveDocument` is called without the `annotationStorage` parameter (PR 12241 follow-up) Obviously it doesn't make sense to call that method without providing an `AnnotationStorage`-instance, however we should ensure that doing so won't cause errors. Hence we need to check that `annotationStorage` is actually defined, before attempting to call its `resetModified` method. --- src/display/api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/display/api.js b/src/display/api.js index 453e073a5..f9a295dcc 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -2544,7 +2544,9 @@ class WorkerTransport { filename: this._fullReader ? this._fullReader.filename : null, }) .finally(() => { - annotationStorage.resetModified(); + if (annotationStorage) { + annotationStorage.resetModified(); + } }); }