From 32fb604c888b218f1a582d39a52add6a4c92e04c Mon Sep 17 00:00:00 2001 From: mposolda Date: Tue, 1 Dec 2015 11:41:32 +0100 Subject: [PATCH] KEYCLOAK-2149 Fix possible NPE during migration --- .../org/keycloak/models/utils/DefaultAuthenticationFlows.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/model/api/src/main/java/org/keycloak/models/utils/DefaultAuthenticationFlows.java b/model/api/src/main/java/org/keycloak/models/utils/DefaultAuthenticationFlows.java index 40a8999910..22c15821fd 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/DefaultAuthenticationFlows.java +++ b/model/api/src/main/java/org/keycloak/models/utils/DefaultAuthenticationFlows.java @@ -429,6 +429,10 @@ public class DefaultAuthenticationFlows { if (migrate) { // Try to read OTP requirement from browser flow AuthenticationFlowModel browserFlow = realm.getBrowserFlow(); + if (browserFlow == null) { + browserFlow = realm.getFlowByAlias(DefaultAuthenticationFlows.BROWSER_FLOW); + } + List browserExecutions = new LinkedList<>(); KeycloakModelUtils.deepFindAuthenticationExecutions(realm, browserFlow, browserExecutions); for (AuthenticationExecutionModel browserExecution : browserExecutions) {