Skip to content

Commit

Permalink
Validate group additions
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Sep 12, 2023
1 parent d5fd535 commit 557b095
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/net/fortuna/ical4j/vcard/VCardGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ public List<VCard> getRevisions() {
public VCard getLatestRevision() {
return getRevisions().get(0);
}

@Override
public VCardContainer add(VCard component) {
if (!cardPredicate.test(component)) {
throw new IllegalArgumentException("Invalid component for this group");
}
return VCardContainer.super.add(component);
}
}

0 comments on commit 557b095

Please sign in to comment.