From 089313aac2415771caa6dd0648dc15ed16fa81e9 Mon Sep 17 00:00:00 2001 From: Paul McPhee Date: Wed, 22 Jan 2025 17:00:59 +0000 Subject: [PATCH] MAN-319 PI-2749: MPOP Activity Search API --- .../uk/gov/justice/digital/hmpps/service/ActivityService.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ActivityService.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ActivityService.kt index 66c5622cb..09a82cc62 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ActivityService.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ActivityService.kt @@ -37,8 +37,9 @@ class ActivityService( val response = probationSearchClient.contactSearch(probationSearchRequest, pageable.pageNumber, pageable.pageSize) val ids = response.results.map { it.id } - val contacts = ids.map { contactId -> - contactRepository.findByPersonIdAndIdIn(summary.id, ids).associateBy { it.id }[contactId]!! + + val contacts = ids.mapNotNull { contactId -> + contactRepository.findByPersonIdAndIdIn(summary.id, ids).associateBy { it.id }[contactId] } return PersonActivitySearchResponse(