diff --git a/source/js/dark-light-toggle.js b/source/js/dark-light-toggle.js index 398bfcb..ee7c494 100644 --- a/source/js/dark-light-toggle.js +++ b/source/js/dark-light-toggle.js @@ -56,7 +56,7 @@ window.addEventListener('DOMContentLoaded', () => { }, initModeToggleButton() { - this.modeToggleButton_dom.addEventListener('click', () => { + this.modeToggleButton_dom && this.modeToggleButton_dom.addEventListener('click', () => { if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { this.setItemUtil('light-mode', 'dark'); } else { diff --git a/source/js/utils.js b/source/js/utils.js index ca902c7..8ffa9cf 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -72,7 +72,7 @@ ILS.utils = { this.toolsMenuButton_dom = document.querySelector('.tools-button'); this.toolsWrapperList_dom = document.querySelectorAll('.tools-wrapper li'); - this.toolsMenuButton_dom.addEventListener('click', e => { + this.toolsMenuButton_dom && this.toolsMenuButton_dom.addEventListener('click', e => { isOpen = !isOpen; const toolsMenuButtonIcon = this.toolsMenuButton_dom.querySelector('i');