From bf553f22da96a6e61dfa9b5804af273a6b13852d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 17 Apr 2025 14:01:53 +0200 Subject: [PATCH] Ensure that the /P-entry is actually a dictionary in `StructTreePage.prototype.addNode` This may fix issue 19822, but without a test-case it's simply impossible to know for sure. --- src/core/struct_tree.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/struct_tree.js b/src/core/struct_tree.js index a8766e92e..59ba40cb6 100644 --- a/src/core/struct_tree.js +++ b/src/core/struct_tree.js @@ -757,7 +757,10 @@ class StructTreePage { const parent = dict.get("P"); - if (!parent || isName(parent.get("Type"), "StructTreeRoot")) { + if ( + !(parent instanceof Dict) || + isName(parent.get("Type"), "StructTreeRoot") + ) { if (!this.addTopLevelNode(dict, element)) { map.delete(dict); }