From 96f7e6adb9a69aa1d39a17d7332b2dcc625bd543 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 15 Oct 2019 15:07:36 +0200 Subject: [PATCH] [BUGFIX] Prevent addCopyListener to add event on undefined button when preview option set to false --- lib/functions.js.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/functions.js.php b/lib/functions.js.php index 845da82..532787d 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -742,8 +742,10 @@ function copyLinkToClipboard(link_id) { } function addCopyListener(button_id, link_id) { - document.getElementById(button_id) + if(document.getElementById(button_id)){ + document.getElementById(button_id) .addEventListener("click", function() { copyLinkToClipboard(link_id);}); + } } // @license-end -- 2.34.1