Skip to content

Commit

Permalink
Merge pull request #937 from woowacourse-teams/be/fix/throw-on-map-npe
Browse files Browse the repository at this point in the history
  • Loading branch information
nayonsoso authored Oct 24, 2024
2 parents a09f665 + 3edfb81 commit a62bed1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,6 +63,10 @@ private List<Answer> getAnswersByQuestionType(ReviewRegisterRequest request) {
private Answer mapRequestToAnswer(Map<Long, Question> 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;
Expand Down

0 comments on commit a62bed1

Please sign in to comment.