Fix NPE if Auto-Submitted header is missing

pull/129/head
Richard Körber 2022-01-22 15:16:37 +01:00
parent 30a9b53746
commit 9115dc743f
No known key found for this signature in database
GPG Key ID: AAB9FD19C78AA3E0
1 changed files with 6 additions and 5 deletions

View File

@ -305,12 +305,13 @@ public final class EmailProcessor {
* @return {@code true} if the mail was auto-generated.
*/
private boolean isAutoGenerated(Message message) throws MessagingException {
for (String header : message.getHeader("Auto-Submitted")) {
if (header.trim().startsWith("auto-generated")) {
return true;
}
String[] autoSubmitted = message.getHeader("Auto-Submitted");
if (autoSubmitted == null) {
return false;
}
return false;
return Arrays.stream(autoSubmitted)
.map(String::trim)
.anyMatch(h -> h.startsWith("auto-generated"));
}
/**