fix: 使用CollUtil.isEmpty判空

This commit is contained in:
caiti 2022-05-17 22:00:06 +08:00
parent 3eb2f3447f
commit 92d7a701b5

View File

@ -250,7 +250,7 @@ public class PermissionServiceImpl implements PermissionService {
public Set<Long> getUserRoleIdsFromCache(Long userId, Collection<Integer> roleStatuses) {
Set<Long> cacheRoleIds = userRoleCache.get(userId);
// 创建用户的时候没有分配角色会存在空指针异常
if (cacheRoleIds == null || cacheRoleIds.isEmpty()) {
if (CollUtil.isEmpty(cacheRoleIds)) {
return Collections.emptySet();
}
Set<Long> roleIds = new HashSet<>(cacheRoleIds);