Skip to content

Commit

Permalink
null check
Browse files Browse the repository at this point in the history
  • Loading branch information
overthestream committed Oct 5, 2024
1 parent fd44765 commit 4b1815f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/domain/hotTopic/dtos/HotTopicInfoResponse.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class HotTopicInfoResponseDto extends HotTopicSumResponseDto {
bestAnswerEntity,
liked,
);
if (bestAnswerEntity) this.bestAnswerId = bestAnswerEntity.id;
if (bestAnswerEntity) this.bestAnswerId = bestAnswerEntity?.id;
this.answers = answerEntities
.filter(
(e) =>
Expand Down
4 changes: 2 additions & 2 deletions src/domain/hotTopic/dtos/HotTopicSumResponse.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export class HotTopicSumResponseDto {
this.createdAt = entity.createdAt.getTime();
this.createdBy = entity.createdBy;
if (bestAnswerEntity) {
this.bestUserName = bestAnswerEntity.user.userNickname;
this.bestAnswer = bestAnswerEntity.answer;
this.bestUserName = bestAnswerEntity?.user?.userNickname;
this.bestAnswer = bestAnswerEntity?.answer;
}
}
@ApiProperty({ description: '질문 id' })
Expand Down

0 comments on commit 4b1815f

Please sign in to comment.