diff --git a/pages/account.html b/pages/account.html
index 09fcc713..db0970ba 100644
--- a/pages/account.html
+++ b/pages/account.html
@@ -14,7 +14,7 @@
diff --git a/pages/blog.html b/pages/blog.html
index 71c400bd..c6a9345f 100644
--- a/pages/blog.html
+++ b/pages/blog.html
@@ -14,7 +14,7 @@
diff --git a/pages/contact.html b/pages/contact.html
index cb067548..0c1515f7 100644
--- a/pages/contact.html
+++ b/pages/contact.html
@@ -14,7 +14,7 @@
diff --git a/pages/events.html b/pages/events.html
index f836c35d..0270e6d8 100644
--- a/pages/events.html
+++ b/pages/events.html
@@ -14,7 +14,7 @@
diff --git a/pages/projects.html b/pages/projects.html
index 1e6aa8b8..147f9dbe 100644
--- a/pages/projects.html
+++ b/pages/projects.html
@@ -14,7 +14,7 @@
diff --git a/pages/services.html b/pages/services.html
index 7735caf1..4f6c5564 100644
--- a/pages/services.html
+++ b/pages/services.html
@@ -14,7 +14,7 @@
diff --git a/pages/webring.html b/pages/webring.html
index 6d378fab..a4c71c9d 100644
--- a/pages/webring.html
+++ b/pages/webring.html
@@ -14,7 +14,7 @@
diff --git a/scripts/main.js b/scripts/main.js
index fb9533da..8ba3f804 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -22,7 +22,8 @@ if (theme !== null) {
}
theme_switcher.addEventListener("click", () => {
- if (theme_switcher.getAttribute("title").indexOf("off") !== -1) {
+ const attribute = theme_switcher.getAttribute("title") ?? "off"
+ if (attribute.indexOf("off") !== -1) {
changeToDarkTheme();
} else {
changeToLightTheme();