fix(auth): 修复超级管理员权限检查中的空指针异常

- 避免 Boolean 类型自动拆箱导致的 NPE 异常
- 使用 Boolean.TRUE.equals() 安全检查超级管理员权限
- 添加注释说明潜在的空值风险
This commit is contained in:
2026-02-03 10:34:55 +08:00
parent d63df710b3
commit 6462e51bc8

View File

@@ -198,7 +198,8 @@ public class SettingController extends BaseController {
if(loginUser == null){ if(loginUser == null){
return fail("请先登录"); return fail("请先登录");
} }
if(!loginUser.getIsSuperAdmin()){ // getIsSuperAdmin() is a Boolean and may be null; avoid NPE from auto-unboxing.
if(!Boolean.TRUE.equals(loginUser.getIsSuperAdmin())){
return fail("权限不足"); return fail("权限不足");
} }