Explorar o código

add:避免获取redis对象为null

wangzl hai 6 meses
pai
achega
08c6e02d81

+ 1 - 1
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/tenant/service/impl/SysTenantServiceImpl.java

@@ -205,7 +205,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
         //校验失效
         SysAdminAddCacheDTO adminCache = cacheUtil.getAdminCache(adminAddDTO.getTenantId());
         //缓存对象内容为空即缓存不存在
-        if (StrUtil.isBlank(adminCache.getTenantId())) {
+        if (ObjectUtil.isNull(adminCache) || StrUtil.isBlank(adminCache.getTenantId())) {
             throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001, "缓存已失效,请重新生成链接添加管理员");
         }
         if(CompareUtil.compare(adminCache.getTenantId(), adminCache.getTenantId(), true)!=0){