mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #12516 from Snuffleupagus/fieldObjects-annotation-undefined
Prevent issues, in `PDFDocument.fieldObjects`, for invalid Annotations
This commit is contained in:
commit
c493dc96fa
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue