diff --git a/services/src/main/java/org/keycloak/services/FormService.java b/services/src/main/java/org/keycloak/services/FormService.java index 02e4af9e0d..210fad6b1e 100755 --- a/services/src/main/java/org/keycloak/services/FormService.java +++ b/services/src/main/java/org/keycloak/services/FormService.java @@ -88,18 +88,20 @@ public interface FormService { private String contextPath; - public FormServiceDataBean(RealmModel realm, UserModel userModel, MultivaluedMap formData, String message){ + public FormServiceDataBean(RealmModel realm, UserModel userModel, MultivaluedMap formData, String message) { this.realm = realm; this.userModel = userModel; this.formData = formData; this.message = message; socialProviders = new LinkedList(); - HashMap socialConfig = realm.getSocialConfig(); - for (Iterator itr = ServiceRegistry.lookupProviders(org.keycloak.social.SocialProvider.class); itr.hasNext();) { - SocialProvider p = itr.next(); - if (socialConfig.containsKey(p.getId() + ".key") && socialConfig.containsKey(p.getId() + ".secret")) { - socialProviders.add(p); + HashMap socialConfig = realm.getSocialConfig(); + if (socialConfig != null) { + for (Iterator itr = ServiceRegistry.lookupProviders(org.keycloak.social.SocialProvider.class); itr.hasNext(); ) { + SocialProvider p = itr.next(); + if (socialConfig.containsKey(p.getId() + ".key") && socialConfig.containsKey(p.getId() + ".secret")) { + socialProviders.add(p); + } } } }