diff --git a/backend/src/main/java/reviewme/review/service/mapper/ReviewMapper.java b/backend/src/main/java/reviewme/review/service/mapper/ReviewMapper.java index c94295f44..68ee776b9 100644 --- a/backend/src/main/java/reviewme/review/service/mapper/ReviewMapper.java +++ b/backend/src/main/java/reviewme/review/service/mapper/ReviewMapper.java @@ -15,6 +15,7 @@ import reviewme.review.service.dto.request.ReviewAnswerRequest; import reviewme.review.service.dto.request.ReviewRegisterRequest; import reviewme.review.service.exception.ReviewGroupNotFoundByReviewRequestCodeException; +import reviewme.review.service.exception.SubmittedQuestionNotFoundException; import reviewme.reviewgroup.domain.ReviewGroup; import reviewme.reviewgroup.repository.ReviewGroupRepository; import reviewme.template.domain.Template; @@ -62,6 +63,10 @@ private List getAnswersByQuestionType(ReviewRegisterRequest request) { private Answer mapRequestToAnswer(Map questions, ReviewAnswerRequest answerRequest) { Question question = questions.get(answerRequest.questionId()); + if (question == null) { + throw new SubmittedQuestionNotFoundException(answerRequest.questionId()); + } + // TODO: 아래 코드를 삭제해야 한다 if (question.isSelectable() && answerRequest.selectedOptionIds() != null && answerRequest.selectedOptionIds().isEmpty()) { return null;