From: sebastien Date: Tue, 15 Oct 2019 13:07:36 +0000 (+0200) Subject: [BUGFIX] Prevent addCopyListener to add event on undefined button when preview option... X-Git-Tag: 4.0.0~14 X-Git-Url: https://git.p6c8.net/jirafeau_project.git/commitdiff_plain/96f7e6adb9a69aa1d39a17d7332b2dcc625bd543?ds=inline;hp=08efa741a5984f3105e4c847d644522ed92d319c [BUGFIX] Prevent addCopyListener to add event on undefined button when preview option set to false --- 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