server: Fix NPE when no recipients configured for sending alerts (#5154)

* Fix NPE when no recipients configured for sending alerts

* Adding logs

* Address comments
This commit is contained in:
Pearl Dsilva 2021-07-05 11:50:10 +05:30 committed by GitHub
parent 50bf2861c0
commit 665142701d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -712,6 +712,11 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
return;
}
if (recipients == null) {
s_logger.warn(String.format("No recipients set in 'alert.email.addresses', skipping sending alert with subject: %s and content: %s", subject, content));
return;
}
SMTPMailProperties mailProps = new SMTPMailProperties();
mailProps.setSender(new MailAddress(senderAddress));
mailProps.setSubject(subject);