diff --git a/src/main/java/sh/libre/scim/core/UserAdapter.java b/src/main/java/sh/libre/scim/core/UserAdapter.java index bc233cb3b7..86262bf637 100644 --- a/src/main/java/sh/libre/scim/core/UserAdapter.java +++ b/src/main/java/sh/libre/scim/core/UserAdapter.java @@ -100,8 +100,12 @@ public class UserAdapter extends Adapter { user.getGroupsStream().flatMap(g -> g.getRoleMappingsStream()) .filter((r) -> r.getFirstAttribute("scim").equals("true")).map((r) -> r.getName()) .forEach(r -> rolesSet.add(r)); - user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true")) - .map((r) -> r.getName()).forEach(r -> rolesSet.add(r)); + // Bug when new user. + try { + user.getRoleMappingsStream().filter((r) -> r.getFirstAttribute("scim").equals("true")) + .map((r) -> r.getName()).forEach(r -> rolesSet.add(r)); + } catch (Exception e) { + } var roles = new String[rolesSet.size()]; rolesSet.toArray(roles); setRoles(roles);