diff --git a/templates/index.html b/templates/index.html
index 34a5c32..f89aab3 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -338,6 +338,12 @@
function setupAutoRefresh() {
const autoRefreshCheckbox = document.getElementById('autoRefresh');
+ // 如果自动刷新复选框不存在,直接返回
+ if (!autoRefreshCheckbox) {
+ console.log('自动刷新功能未启用(元素不存在)');
+ return;
+ }
+
// 初始化自动刷新
if (autoRefreshCheckbox.checked) {
startAutoRefresh();