From 63b19389c1b4d0b2ad8a345c700a1dac078ef12d Mon Sep 17 00:00:00 2001 From: Oleksandr Kochubei Date: Fri, 19 Feb 2021 13:31:03 +0200 Subject: [PATCH] KEYCLOAK-17189 - fixed NPE during migration due to missed "account" client --- .../java/org/keycloak/migration/migrators/MigrateTo12_0_0.java | 1 + 1 file changed, 1 insertion(+) diff --git a/server-spi-private/src/main/java/org/keycloak/migration/migrators/MigrateTo12_0_0.java b/server-spi-private/src/main/java/org/keycloak/migration/migrators/MigrateTo12_0_0.java index 7a1f2077df..3e98f7d629 100644 --- a/server-spi-private/src/main/java/org/keycloak/migration/migrators/MigrateTo12_0_0.java +++ b/server-spi-private/src/main/java/org/keycloak/migration/migrators/MigrateTo12_0_0.java @@ -45,6 +45,7 @@ public class MigrateTo12_0_0 implements Migration { session.realms() .getRealmsStream() .map(realm -> realm.getClientByClientId(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID)) + .filter(Objects::nonNull) .filter(client -> Objects.isNull(client.getRole(AccountRoles.DELETE_ACCOUNT))) .forEach(client -> client.addRole(AccountRoles.DELETE_ACCOUNT) .setDescription("${role_" + AccountRoles.DELETE_ACCOUNT + "}"));