fix(auth): 修复超级管理员权限检查中的空指针异常
- 避免 Boolean 类型自动拆箱导致的 NPE 异常 - 使用 Boolean.TRUE.equals() 安全检查超级管理员权限 - 添加注释说明潜在的空值风险
This commit is contained in:
@@ -198,7 +198,8 @@ public class SettingController extends BaseController {
|
||||
if(loginUser == null){
|
||||
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("权限不足");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user