ONOS-6415: NPE in Topo2Jsonifier
- check made for returned backing host being null.
Change-Id: Ib7df17c45d4b39a85662ec5e37dab4821da8225d
(cherry picked from commit 0a9b5a1c1d4f21a4426b1d2e62d1e951a38c2c04)
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
index 85deaa1..21e85c8 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/Topo2Jsonifier.java
@@ -568,9 +568,12 @@
// TODO: complete host details
Host h = host.backingHost();
- addIps(node, h);
- addProps(node, h);
- addGeoGridLocation(node, h);
+ // h will be null, for example, after a HOST_REMOVED event
+ if (h != null) {
+ addIps(node, h);
+ addProps(node, h);
+ addGeoGridLocation(node, h);
+ }
addMetaUi(node, ridStr, host.idAsString());
return node;