diff --git a/src/main/java/com/cmc/zenefitserver/domain/userpolicy/application/UserPolicyService.java b/src/main/java/com/cmc/zenefitserver/domain/userpolicy/application/UserPolicyService.java index 54b0fe1..e03c039 100644 --- a/src/main/java/com/cmc/zenefitserver/domain/userpolicy/application/UserPolicyService.java +++ b/src/main/java/com/cmc/zenefitserver/domain/userpolicy/application/UserPolicyService.java @@ -53,7 +53,7 @@ public void saveInterestPolicy(User user, Long policyId) { throw new BusinessException(ErrorCode.ALREADY_EXISTS_INTEREST_USER_POLICY); } - if (findUserPolicy == null) { + if (findUserPolicy != null && findUserPolicy == null) { findUserPolicy = UserPolicy.builder() .user(findUser) .policy(findPolicy) @@ -78,7 +78,7 @@ public void saveApplyPolicy(User user, Long policyId) { UserPolicy findUserPolicy = userPolicyRepository.findByUser_userIdAndPolicy_Id(findUser.getUserId(), findPolicy.getId()) .orElse(null); - if (findUserPolicy.isApplyFlag()) { + if (findUserPolicy != null && findUserPolicy.isApplyFlag()) { throw new BusinessException(ErrorCode.ALREADY_EXISTS_INTEREST_USER_POLICY); }