From a63336764f0bfeecc0842ff0583efa743542d341 Mon Sep 17 00:00:00 2001 From: shuaiplus <2327005759@qq.com> Date: Sat, 23 May 2026 03:19:49 +0800 Subject: [PATCH] fix: improve lock timeout retrieval by handling null and empty values --- webapp/src/App.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/src/App.tsx b/webapp/src/App.tsx index a528c0b..841d4e0 100644 --- a/webapp/src/App.tsx +++ b/webapp/src/App.tsx @@ -146,7 +146,9 @@ function resolveSystemTheme(): 'light' | 'dark' { function readLockTimeoutMinutes(): LockTimeoutMinutes { if (typeof window === 'undefined') return 15; - const value = Number(window.localStorage.getItem(LOCK_TIMEOUT_STORAGE_KEY)); + const stored = window.localStorage.getItem(LOCK_TIMEOUT_STORAGE_KEY); + if (stored === null || stored.trim() === '') return 15; + const value = Number(stored); return LOCK_TIMEOUT_VALUES.has(value as LockTimeoutMinutes) ? (value as LockTimeoutMinutes) : 15; }