Fixing NPE that can arise due to invalid host configuration.

Prevents NetworkConfigHostProvider from aborted activation.

Change-Id: I746cded81f8b264a6010475ab4b44a3010e69796
diff --git a/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java b/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java
index a0be2d9..38db63a 100644
--- a/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java
+++ b/providers/netcfghost/src/main/java/org/onosproject/provider/netcfghost/NetworkConfigHostProvider.java
@@ -194,12 +194,17 @@
             BasicHostConfig hostConfig =
                     networkConfigRegistry.getConfig(hostId, BasicHostConfig.class);
             Set<IpAddress> ipAddresses = hostConfig.ipAddresses();
-            Set<HostLocation> locations = hostConfig.locations().stream()
-                    .map(hostLocation -> new HostLocation(hostLocation, System.currentTimeMillis()))
-                    .collect(Collectors.toSet());
-            VlanId innerVlan = hostConfig.innerVlan();
-            EthType outerTpid = hostConfig.outerTpid();
-            addHost(mac, vlan, locations, ipAddresses, innerVlan, outerTpid);
+            Set<HostLocation> locs = hostConfig.locations();
+            if (locs != null) {
+                Set<HostLocation> locations = locs.stream()
+                        .map(hostLocation -> new HostLocation(hostLocation, System.currentTimeMillis()))
+                        .collect(Collectors.toSet());
+                VlanId innerVlan = hostConfig.innerVlan();
+                EthType outerTpid = hostConfig.outerTpid();
+                addHost(mac, vlan, locations, ipAddresses, innerVlan, outerTpid);
+            } else {
+                log.warn("Host {} configuration {} is missing locations", hostId, hostConfig);
+            }
         });
     }