diff --git a/services/src/main/java/org/keycloak/userprofile/LegacyAttributes.java b/services/src/main/java/org/keycloak/userprofile/LegacyAttributes.java index eaba623287..0c0aa44af1 100644 --- a/services/src/main/java/org/keycloak/userprofile/LegacyAttributes.java +++ b/services/src/main/java/org/keycloak/userprofile/LegacyAttributes.java @@ -40,16 +40,10 @@ public class LegacyAttributes extends DefaultAttributes { @Override public Map> getReadable() { - if(user == null) - return null; + if(user == null || user.getAttributes() == null) + return new HashMap<>(); - Map> attributes = new HashMap<>(user.getAttributes()); - - if (attributes.isEmpty()) { - return null; - } - - return attributes; + return new HashMap<>(user.getAttributes()); } @Override