Skip to content

Commit

Permalink
[Fix][Admin] Fix the null pointer exception in the user list of the r…
Browse files Browse the repository at this point in the history
…ole (DataLinkDC#3327)

Co-authored-by: luoshangjie <luoshangjie@yfpharmacy.com>
  • Loading branch information
18216499322 and luoshangjie authored Mar 26, 2024
1 parent 0eec1d4 commit 236a190
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -180,7 +181,12 @@ public List<User> getUserListByRoleId(Integer roleId) {
List<User> userList = new ArrayList<>();

if (Asserts.isNotNull(userRoleList)) {
userRoleList.forEach(userRole -> userList.add(userService.getById(userRole.getUserId())));
userRoleList.forEach(userRole -> {
User user = userService.getById(userRole.getUserId());
if (Objects.nonNull(user)) {
userList.add(user);
}
});
}
return userList;
}
Expand Down

0 comments on commit 236a190

Please sign in to comment.