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.
This commit is contained in:
Thomas Darimont 2017-11-11 21:46:51 +01:00
parent 0dfbe01c73
commit a5b73a365d

View file

@ -195,7 +195,7 @@ class UserPermissions implements UserPermissionEvaluator, UserPermissionManageme
} }
Resource usersResource = authz.getStoreFactory().getResourceStore().findByName(USERS_RESOURCE, server.getId()); Resource usersResource = authz.getStoreFactory().getResourceStore().findByName(USERS_RESOURCE, server.getId());
if (usersResource == null) { if (usersResource != null) {
authz.getStoreFactory().getResourceStore().delete(usersResource.getId()); authz.getStoreFactory().getResourceStore().delete(usersResource.getId());
} }
} }