diff --git a/YLErpWeb/Views/Account/Login.cshtml b/YLErpWeb/Views/Account/Login.cshtml
index c3e8ae00..f71d0ea7 100644
--- a/YLErpWeb/Views/Account/Login.cshtml
+++ b/YLErpWeb/Views/Account/Login.cshtml
@@ -34,6 +34,7 @@
})
function CaptchaClick(){
var img = document.getElementById('captcha');
+ if (!img) return; // NeedCaptcha=false 时验证码 img 不渲染,避免 null.setAttribute 报错
var newSrc = '@captchaUrl' + '&t=' + new Date().getTime();
img.setAttribute('src', newSrc);
}