diff --git a/src/main/java/de/adorsys/keycloak/config/service/RealmImportService.java b/src/main/java/de/adorsys/keycloak/config/service/RealmImportService.java index c1af0878e..303c7e7f0 100644 --- a/src/main/java/de/adorsys/keycloak/config/service/RealmImportService.java +++ b/src/main/java/de/adorsys/keycloak/config/service/RealmImportService.java @@ -169,7 +169,13 @@ private void setEventsEnabledWorkaround(RealmImport realmImport) { if (realmImport.isEventsEnabled() != null) return; Boolean existingEventsEnabled = realmRepository.get(realmImport.getRealm()).isEventsEnabled(); - realmImport.setEventsEnabled(existingEventsEnabled); + if (existingEventsEnabled != null) { + realmImport.setEventsEnabled(existingEventsEnabled); + } else { + realmImport.setEventsEnabled(false); + logger.warn("Events enabled status is null for realm '{}'. " + "Setting to false by default.", realmImport.getRealm()); + } + } private void createRealm(RealmImport realmImport) {