Don't try to collect a nonexistent field because of an invalid ref
This commit is contained in:
parent
72338ce05d
commit
acc62f80de
@ -1713,6 +1713,9 @@ class PDFDocument {
|
|||||||
|
|
||||||
#collectFieldObjects(name, fieldRef, promises, annotationGlobals) {
|
#collectFieldObjects(name, fieldRef, promises, annotationGlobals) {
|
||||||
const field = this.xref.fetchIfRef(fieldRef);
|
const field = this.xref.fetchIfRef(fieldRef);
|
||||||
|
if (!(field instanceof Dict)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (field.has("T")) {
|
if (field.has("T")) {
|
||||||
const partName = stringToPDFString(field.get("T"));
|
const partName = stringToPDFString(field.get("T"));
|
||||||
name = name === "" ? partName : `${name}.${partName}`;
|
name = name === "" ? partName : `${name}.${partName}`;
|
||||||
@ -1737,8 +1740,9 @@ class PDFDocument {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (field.has("Kids")) {
|
const kids = field.get("Kids");
|
||||||
for (const kid of field.get("Kids")) {
|
if (Array.isArray(kids)) {
|
||||||
|
for (const kid of kids) {
|
||||||
this.#collectFieldObjects(name, kid, promises, annotationGlobals);
|
this.#collectFieldObjects(name, kid, promises, annotationGlobals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
test/pdfs/issue17232.pdf.link
Normal file
2
test/pdfs/issue17232.pdf.link
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
https://github.com/mozilla/pdf.js/files/13280636/aanvraag-beeindiging-aansluiting.pdf
|
||||||
|
|
@ -8197,5 +8197,14 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq",
|
"type": "eq",
|
||||||
"annotations": true
|
"annotations": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "issue17232-annotations",
|
||||||
|
"file": "pdfs/issue17232.pdf",
|
||||||
|
"md5": "90ade9fc5721ddf8d17e8cfc43e186a4",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"type": "eq",
|
||||||
|
"annotations": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user