Skip to content

Commit f0b48fe

Browse files
Rekai MusukaJoshua Nelson
Rekai Musuka
authored and
Joshua Nelson
committed
Add check for potentially null .getElementById()
1 parent 72dbbed commit f0b48fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

templates/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ function copyTextHandler() {
2222
crateTitleAndVersion.style.textTransform = oldTransform;
2323
}
2424

25-
document.getElementById("clipboard").addEventListener("click", copyTextHandler);
25+
(function() {
26+
const clipboard = document.getElementById("clipboard");
27+
if (clipboard != null) clipboard.addEventListener("click", copyTextHandler);
28+
})();

0 commit comments

Comments
 (0)