1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

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.
This commit is contained in:
Jonas Jenwald 2025-04-17 13:57:30 +02:00
parent 2f7d163dfd
commit 76f23ce3b5

View file

@ -707,10 +707,18 @@ class Page {
// Ensure that the structTree will contain the page's annotations.
await this._parsedAnnotations;
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [
structTreeRoot,
]);
return this.pdfManager.ensure(structTree, "serializable");
try {
const structTree = await this.pdfManager.ensure(
this,
"_parseStructTree",
[structTreeRoot]
);
const data = await this.pdfManager.ensure(structTree, "serializable");
return data;
} catch (ex) {
warn(`getStructTree: "${ex}".`);
return null;
}
}
/**