From 98dc21e6fc2b5a46b18d8ee5f9f1d271d8bf5ffe Mon Sep 17 00:00:00 2001 From: Stefan Guilhen Date: Wed, 21 Aug 2024 18:49:19 -0300 Subject: [PATCH] Add non-null filter when fetching groups. Closes #32321 Signed-off-by: Stefan Guilhen --- .../src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java index ac6b11ea51..bb611f6d13 100644 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java @@ -594,7 +594,7 @@ public class JpaRealmProvider implements RealmProvider, ClientProvider, ClientSc @Override public Stream getGroupsStream(RealmModel realm, Stream ids) { - return ids.map(id -> session.groups().getGroupById(realm, id)).sorted(GroupModel.COMPARE_BY_NAME); + return ids.map(id -> session.groups().getGroupById(realm, id)).filter(Objects::nonNull).sorted(GroupModel.COMPARE_BY_NAME); } @Override