avoid NPE in LegacyAttributes when using federated storage

Closes #https://github.com/keycloak/keycloak/issues/15482
This commit is contained in:
zak905 2021-12-20 21:45:45 +01:00 committed by Pedro Igor
parent 21cce0a1d3
commit 993d910520

View file

@ -40,16 +40,10 @@ public class LegacyAttributes extends DefaultAttributes {
@Override
public Map<String, List<String>> getReadable() {
if(user == null)
return null;
if(user == null || user.getAttributes() == null)
return new HashMap<>();
Map<String, List<String>> attributes = new HashMap<>(user.getAttributes());
if (attributes.isEmpty()) {
return null;
}
return attributes;
return new HashMap<>(user.getAttributes());
}
@Override