Fixing a couple of NPE in the newly added Connection Manager UI.
[controller.git] / opendaylight / web / devices / src / main / java / org / opendaylight / controller / devices / web / Devices.java
index 91261f6499fe6092595117d9f90e1eb967f4003a..3d33edcbf2272c308cdb2236c574aaa42cd95ed9 100644 (file)
@@ -751,9 +751,15 @@ public class Devices implements IDaylightWeb {
 
         Set<Node> nodes = connectionManager.getLocalNodes();
         List<NodeJsonBean> result = new LinkedList<NodeJsonBean>();
+        if (nodes == null) {
+            return result;
+        }
         for (Node node : nodes) {
             Description descriptionProperty = (Description) switchManager.getNodeProp(node, "description");
-            String description = descriptionProperty.getValue();
+            String description = node.toString();
+            if (descriptionProperty != null) {
+                description = descriptionProperty.getValue();
+            }
             NodeJsonBean nodeBean = new NodeJsonBean();
             nodeBean.setNodeId(node.getNodeIDString());
             nodeBean.setNodeType(node.getType());
@@ -860,4 +866,4 @@ public class Devices implements IDaylightWeb {
         return "forward:" + "/";
     }
 
-}
\ No newline at end of file
+}