KEYCLOAK-7194: avoid NullPointerException (#5157)

This commit is contained in:
Ingo Bauersachs 2018-04-20 09:24:12 +02:00 committed by Stian Thorgersen
parent c3c1a0fb4e
commit 5e4d173f1d

View file

@ -561,7 +561,10 @@ public class LDAPStorageProviderFactory implements UserStorageProviderFactory<LD
LDAPStorageMapper ldapMapper = ldapFedProvider.getMapperManager().getMapper(mapperModel); LDAPStorageMapper ldapMapper = ldapFedProvider.getMapperManager().getMapper(mapperModel);
ldapMapper.onImportUserFromLDAP(ldapUser, currentUser, currentRealm, false); ldapMapper.onImportUserFromLDAP(ldapUser, currentUser, currentRealm, false);
} }
session.userCache().evict(currentRealm, currentUser); UserCache userCache = session.userCache();
if (userCache != null) {
userCache.evict(currentRealm, currentUser);
}
logger.debugf("Updated user from LDAP: %s", currentUser.getUsername()); logger.debugf("Updated user from LDAP: %s", currentUser.getUsername());
syncResult.increaseUpdated(); syncResult.increaseUpdated();
} else { } else {