diff --git a/themes/patek/assets/js/dark-mode.js b/themes/patek/assets/js/dark-mode.js index a5217a4..7cc5468 100644 --- a/themes/patek/assets/js/dark-mode.js +++ b/themes/patek/assets/js/dark-mode.js @@ -3,7 +3,7 @@ function restoreDarkmode() { const elem = document.getElementById("content"); if (!document.cookie.includes("dark-mode=")) { - if (prefersDarkMode.matches) { + if (elem && prefersDarkMode.matches) { elem.classList.add("dark-mode"); } }