diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 15657e330..7e3b4cfa8 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1440,8 +1440,8 @@ class PushButtonWidgetAnnotationElement extends LinkAnnotationElement { container.title = this.data.alternativeText; } - if (this.enableScripting && this.hasJSActions) { - const linkElement = container.lastChild; + const linkElement = container.lastChild; + if (this.enableScripting && this.hasJSActions && linkElement) { this._setDefaultPropertiesFromJS(linkElement); linkElement.addEventListener("updatefromsandbox", jsEvent => { diff --git a/test/pdfs/bug1778692.pdf.link b/test/pdfs/bug1778692.pdf.link new file mode 100644 index 000000000..eacfdbb08 --- /dev/null +++ b/test/pdfs/bug1778692.pdf.link @@ -0,0 +1,2 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=9284681 + diff --git a/test/test_manifest.json b/test/test_manifest.json index 81fb2d0a8..703da1161 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -6837,5 +6837,15 @@ "rotation": 270 } } + }, + { "id": "bug1778692", + "file": "pdfs/bug1778692.pdf", + "md5": "8855414caaa04fbbdfad1545d1c8a8ae", + "rounds": 1, + "link": true, + "firstPage": 2, + "lastPage": 2, + "type": "eq", + "annotations": true } ]