Skip to content

Commit

Permalink
fix: check if null first
Browse files Browse the repository at this point in the history
  • Loading branch information
becooq81 committed Sep 25, 2023
1 parent e93e9ce commit a7d8dd4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class CommentService {
private final NotificationService notificationService;
public Comment createComment(CommentCreateValues values) {
Comment parent = null;
if (values.getParentId() != 0 && values.getParentId() != null) parent = findById(values.getParentId());
if (values.getParentId() != null && values.getParentId() != 0) parent = findById(values.getParentId());
if (parent != null && parent.getIsChild()) {
throw new IllegalArgumentException("대댓글에 대댓글을 달 수 없습니다.");
} else {
Expand Down

0 comments on commit a7d8dd4

Please sign in to comment.