Skip to content

Commit

Permalink
[fix] 도시 여행지 대표 사진 추출 로직 NPE 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
jo0oy committed Jan 28, 2024
1 parent d851954 commit a6c79f7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ public List<CityPlaceWithLatLongResponseDto> getPlacesWithLatLong(Long cityId) {
return places
.stream()
.map(place -> {
String imageUrl = imageMap.get(place.getId()).get(0).imageUrl();
String imageUrl = Objects.isNull(imageMap.get(place.getId())) ? null :
imageMap.get(place.getId())
.stream()
.filter(Objects::nonNull)
.findFirst()
.map(TripRecordScheduleImageWithPlaceIdQueryDto::imageUrl)
.orElse(null);

return CityPlaceWithLatLongResponseDto.fromEntity(place, imageUrl);
})
.toList();
Expand Down

0 comments on commit a6c79f7

Please sign in to comment.