diff --git a/src/main/java/com/apps/pochak/global/annotation/ValidDuplicateListValidator.java b/src/main/java/com/apps/pochak/global/annotation/ValidDuplicateListValidator.java index 70b3692c..607093a2 100644 --- a/src/main/java/com/apps/pochak/global/annotation/ValidDuplicateListValidator.java +++ b/src/main/java/com/apps/pochak/global/annotation/ValidDuplicateListValidator.java @@ -8,6 +8,7 @@ public class ValidDuplicateListValidator implements ConstraintValidator> { @Override public boolean isValid(final List stringList, final ConstraintValidatorContext constraintValidatorContext) { + if (stringList == null) return true; final long uniqueCount = stringList.stream().distinct().count(); return uniqueCount == stringList.size(); } diff --git a/src/main/java/com/apps/pochak/post/dto/request/PostUploadRequest.java b/src/main/java/com/apps/pochak/post/dto/request/PostUploadRequest.java index 57e8df63..3a811b16 100644 --- a/src/main/java/com/apps/pochak/post/dto/request/PostUploadRequest.java +++ b/src/main/java/com/apps/pochak/post/dto/request/PostUploadRequest.java @@ -60,7 +60,8 @@ public boolean validateTaggedMember() { } public List getAllTaggedMember() { - List temp = new ArrayList<>(taggedMemberHandleList); + List temp = taggedMemberHandleList != null ? + new ArrayList<>(taggedMemberHandleList) : new ArrayList<>(); if (pinnedHandle != null) { temp.add(pinnedHandle); } @@ -70,6 +71,7 @@ public List getAllTaggedMember() { public void validateMemberNotTagged( final Member member ) { + if (taggedMemberHandleList == null) return; if (taggedMemberHandleList.contains(member.getHandle())) { throw new GeneralException(TAG_INVALID_MEMBER); }