Protect from stupid null usage by javax.mail.
If you add no addresses to a message, getting the recipient array returns null rather than an empty array. So fucking dumb.
This commit is contained in:
@@ -136,7 +136,7 @@ public class MailUtil
|
||||
}
|
||||
message.saveChanges();
|
||||
Address[] recips = message.getAllRecipients();
|
||||
if (recips.length == 0) {
|
||||
if (recips == null || recips.length == 0) {
|
||||
log.info("Not sending mail to zero recipients",
|
||||
"subject", subject, "message", message);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user