Skip to content

Commit

Permalink
Filter recipients settings to prevent NPE (RedHatInsights#2311)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenneg authored Nov 6, 2023
1 parent 05fc793 commit 2e2ff1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void extract(final Exchange exchange, final JsonObject cloudEventData) {
.toList();

final Set<String> emails = recipientSettings.stream()
.filter(settings -> settings.getEmails() != null)
.flatMap(settings -> settings.getEmails().stream())
.collect(toSet());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
Expand Down Expand Up @@ -40,7 +39,7 @@ void testExtract() {
true,
UUID.randomUUID(),
users,
Collections.emptySet()
null
);

final Set<String> users2 = Set.of("d", "e", "f");
Expand Down

0 comments on commit 2e2ff1a

Please sign in to comment.