This is an automated email from the ASF dual-hosted git repository.

DaanHoogland pushed a commit to branch ghi7297-messages
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/ghi7297-messages by this push:
     new 3a519595ad2 NPE guard
3a519595ad2 is described below

commit 3a519595ad27938123472b2614ce4122ac16e022
Author: Daan Hoogland <[email protected]>
AuthorDate: Tue Aug 4 06:23:32 2026 +0200

    NPE guard
---
 .../src/main/java/com/cloud/alert/AlertFormatUtils.java             | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/engine/components-api/src/main/java/com/cloud/alert/AlertFormatUtils.java 
b/engine/components-api/src/main/java/com/cloud/alert/AlertFormatUtils.java
index 390e1a77097..41c90a0f73f 100644
--- a/engine/components-api/src/main/java/com/cloud/alert/AlertFormatUtils.java
+++ b/engine/components-api/src/main/java/com/cloud/alert/AlertFormatUtils.java
@@ -31,6 +31,12 @@ public final class AlertFormatUtils {
     }
 
     public static String describeHostLocation(Host host, DataCenter zone, Pod 
pod) {
+        if (host == null) {
+            // we should never get here, but if we do, at least we won't get 
an NPE
+            return String.format("No host to describe for availability zone: 
%s, pod: %s",
+                    zone != null ? zone.getName() : "unknown",
+                    pod != null ? pod.getName() : "unknown");
+        }
         return String.format("name: %s (id: %d, uuid: %s), availability zone: 
%s, pod: %s",
                 host.getName(), host.getId(), host.getUuid(),
                 zone != null ? zone.getName() : "unknown",

Reply via email to