diff --git a/src/main/java/sopt/org/hmh/domain/challenge/service/ChallengeFacade.java b/src/main/java/sopt/org/hmh/domain/challenge/service/ChallengeFacade.java index f49bbbc7..a8e984e6 100644 --- a/src/main/java/sopt/org/hmh/domain/challenge/service/ChallengeFacade.java +++ b/src/main/java/sopt/org/hmh/domain/challenge/service/ChallengeFacade.java @@ -33,7 +33,8 @@ public class ChallengeFacade { @Transactional public Challenge addChallenge(Long userId, ChallengeRequest challengeRequest, String os) { User user = userService.findByIdOrThrowException(userId); - Optional previousChallengeId = Optional.of(user.getCurrentChallengeId()); + + Optional previousChallengeId = Optional.ofNullable(user.getCurrentChallengeId()); Challenge challenge = challengeService.save(challengeRequest.toEntity(userId)); user.changeCurrentChallengeId(challenge.getId());