Skip to content

Commit

Permalink
Merge pull request #12516 from Snuffleupagus/fieldObjects-annotation-…
Browse files Browse the repository at this point in the history
…undefined

Prevent issues, in `PDFDocument.fieldObjects`, for invalid Annotations
  • Loading branch information
timvandermeij authored Oct 24, 2020
2 parents 1eaf9c9 + b44a975 commit c493dc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ class PDFDocument {
this.pdfManager,
this._localIdFactory
)
.then(annotation => annotation.getFieldObject())
.then(annotation => annotation && annotation.getFieldObject())
.catch(function (reason) {
warn(`_collectFieldObjects: "${reason}".`);
return null;
Expand Down Expand Up @@ -999,7 +999,7 @@ class PDFDocument {
for (const [name, promises] of fieldPromises) {
allPromises.push(
Promise.all(promises).then(fields => {
fields = fields.filter(field => field !== null);
fields = fields.filter(field => !!field);
if (fields.length > 0) {
allFields[name] = fields;
}
Expand Down

0 comments on commit c493dc9

Please sign in to comment.