fix: handle localStorage not enabled gracefully (#1786)

This commit is contained in:
Alessandro (Ale) Segala
2026-09-28 16:49:12 +02:00
committed by GitHub
parent ffb07b1811
commit 0660524dc6
4 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<link rel="apple-touch-icon" href="/img/static-logo-512.png" />
<script>
try {
const mode = localStorage.getItem('mode-watcher-mode') || 'system';
const mode = localStorage?.getItem('mode-watcher-mode') || 'system';
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const isDark = mode === 'dark' || (mode === 'system' && prefersDark);