diff --git a/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java b/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java index 2a382d7..2093579 100644 --- a/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java +++ b/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java @@ -62,7 +62,7 @@ public ResponseEntity getCulturalEventList( Member member = memberJwtService.getMember(); // Save Search Keyword - if (keyword != null) { + if (keyword != null && member != null) { culturalEventSearchKeywordService.createCulturalEventSearchKeyword(member, keyword); } diff --git a/src/main/java/project/backend/domain/keyword/service/CulturalEventSearchKeywordService.java b/src/main/java/project/backend/domain/keyword/service/CulturalEventSearchKeywordService.java index 6649874..21dbd34 100644 --- a/src/main/java/project/backend/domain/keyword/service/CulturalEventSearchKeywordService.java +++ b/src/main/java/project/backend/domain/keyword/service/CulturalEventSearchKeywordService.java @@ -39,7 +39,7 @@ public class CulturalEventSearchKeywordService { public void createCulturalEventSearchKeyword(Member member, String keyword) { Optional culturalEventSearchKeywordOptional = culturalEventSearchKeywordRepository.findFirstByMemberAndKeywordAndIsRecentTrue(member, keyword); - if (culturalEventSearchKeywordOptional.isEmpty()) { + if (!culturalEventSearchKeywordOptional.isPresent()) { CulturalEventSearchKeyword culturalEventSearchKeyword = CulturalEventSearchKeyword.builder() .keyword(keyword).build(); culturalEventSearchKeyword.setMember(member);