ONOS-6667
NullPointerException on device-remove
Change-Id: I5bc41227a0535b73cb3969a584f8affc736ae6cc
(cherry picked from commit edeaf4a49e6c19b7fce75f4c11467a6e7c8c4513)
diff --git a/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java b/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java
index e836233..f757f62 100644
--- a/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java
+++ b/core/api/src/main/java/org/onosproject/ui/model/topo/UiDevice.java
@@ -112,6 +112,7 @@
* @return the device type
*/
public String type() {
- return backingDevice().type().toString().toLowerCase();
+ Device device = backingDevice();
+ return device == null ? null : device.type().toString().toLowerCase();
}
}
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 21e85c8..214553e 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
@@ -453,11 +453,11 @@
.put("online", deviceService.isAvailable(device.id()))
.put("master", master(device.id()))
.put("layer", device.layer());
-
Device d = device.backingDevice();
-
- addProps(node, d);
- addGeoGridLocation(node, d);
+ if (d != null) {
+ addProps(node, d);
+ addGeoGridLocation(node, d);
+ }
addMetaUi(node, ridStr, device.idAsString());
return node;