Skip to content

Commit 76f23ce

Browse files
committed
Catch, and ignore, errors during Page.prototype.getStructTree
This way any errors thrown during parsing of the page-structTree will not be forwarded to the viewer.
1 parent 2f7d163 commit 76f23ce

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/core/document.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,10 +707,18 @@ class Page {
707707
// Ensure that the structTree will contain the page's annotations.
708708
await this._parsedAnnotations;
709709

710-
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [
711-
structTreeRoot,
712-
]);
713-
return this.pdfManager.ensure(structTree, "serializable");
710+
try {
711+
const structTree = await this.pdfManager.ensure(
712+
this,
713+
"_parseStructTree",
714+
[structTreeRoot]
715+
);
716+
const data = await this.pdfManager.ensure(structTree, "serializable");
717+
return data;
718+
} catch (ex) {
719+
warn(`getStructTree: "${ex}".`);
720+
return null;
721+
}
714722
}
715723

716724
/**

0 commit comments

Comments
 (0)