Fix some NPEs and stack traces in alerting.

[Review issue 9462002]
Missed commit.

[Review issue ]