Skip to content

Commit

Permalink
NPE in user-storage-jpa when searching by empty string
Browse files Browse the repository at this point in the history
Closes #546

Signed-off-by: Martin Kanis <[email protected]>
(cherry picked from commit ac86833)
  • Loading branch information
martin-kanis authored and hmlnarik committed May 16, 2024
1 parent 3db9ea2 commit c822b40
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public int getUsersCount(RealmModel realm) {
public Stream<UserModel> searchForUserStream(RealmModel realm, Map<String, String> params, Integer firstResult, Integer maxResults) {
String search = params.get(UserModel.SEARCH);
TypedQuery<UserEntity> query = em.createNamedQuery("searchForUser", UserEntity.class);
query.setParameter("search", "%" + search.toLowerCase() + "%");
String lower = search != null ? search.toLowerCase() : "";
query.setParameter("search", "%" + lower + "%");
if (firstResult != null) {
query.setFirstResult(firstResult);
}
Expand Down

0 comments on commit c822b40

Please sign in to comment.