Skip to content

Commit

Permalink
Skip fieldObjects that are not actually References
Browse files Browse the repository at this point in the history
The `fieldObjects`-getter is implemented in the `PDFDocument` class, which means that the `this._localIdFactory`-property that we pass to `AnnotationFactory.create` doesn't actually exist.
The reason that this hasn't caused any bugs, that I'm aware of, is that all /Fields-entries need to be References to actually make sense.
  • Loading branch information
Snuffleupagus committed Nov 8, 2023
1 parent 65c827b commit ff62fc8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,10 @@ class PDFDocument {
async #collectFieldObjects(name, fieldRef, promises, annotationGlobals) {
const { xref } = this;

const field = await xref.fetchIfRefAsync(fieldRef);
if (!(fieldRef instanceof Ref)) {
return;
}
const field = await xref.fetchAsync(fieldRef);
if (!(field instanceof Dict)) {
return;
}
Expand All @@ -1731,7 +1734,7 @@ class PDFDocument {
xref,
fieldRef,
annotationGlobals,
this._localIdFactory,
/* idFactory = */ null,
/* collectFields */ true,
/* pageRef */ null
)
Expand Down

0 comments on commit ff62fc8

Please sign in to comment.