From a5b73a365d55221e123fa1ec0ff319a1b824cddb Mon Sep 17 00:00:00 2001 From: Thomas Darimont Date: Sat, 11 Nov 2017 21:46:51 +0100 Subject: [PATCH] KEYCLOAK-5841 Fix NPE in deletePermissionSetup in UserPermissions Previously a call to `UserPermissions#deletePermissionSetup` always resulted in a NPE if the usersResource was null. We now only try to delete the resourceStore information if the given usersResource is not null. --- .../services/resources/admin/permissions/UserPermissions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/src/main/java/org/keycloak/services/resources/admin/permissions/UserPermissions.java b/services/src/main/java/org/keycloak/services/resources/admin/permissions/UserPermissions.java index 55b7fb489a..a8d9c8ba87 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/permissions/UserPermissions.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/permissions/UserPermissions.java @@ -195,7 +195,7 @@ class UserPermissions implements UserPermissionEvaluator, UserPermissionManageme } Resource usersResource = authz.getStoreFactory().getResourceStore().findByName(USERS_RESOURCE, server.getId()); - if (usersResource == null) { + if (usersResource != null) { authz.getStoreFactory().getResourceStore().delete(usersResource.getId()); } }