Skip to content

Commit 6651427

Browse files
authored
server: Fix NPE when no recipients configured for sending alerts (#5154)
* Fix NPE when no recipients configured for sending alerts * Adding logs * Address comments
1 parent 50bf286 commit 6651427

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/src/main/java/com/cloud/alert/AlertManagerImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,11 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
712712
return;
713713
}
714714

715+
if (recipients == null) {
716+
s_logger.warn(String.format("No recipients set in 'alert.email.addresses', skipping sending alert with subject: %s and content: %s", subject, content));
717+
return;
718+
}
719+
715720
SMTPMailProperties mailProps = new SMTPMailProperties();
716721
mailProps.setSender(new MailAddress(senderAddress));
717722
mailProps.setSubject(subject);

0 commit comments

Comments
 (0)