Fix NPE in NetworkConfigHostProvider

Change-Id: I87800be981255adbb98ed8e53ea725625f2b3177
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 fefecab..42278d3 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
@@ -172,15 +172,19 @@
             HostId hostId = (HostId) event.subject();
             MacAddress mac = hostId.mac();
             VlanId vlan = hostId.vlanId();
-            BasicHostConfig hostConfig =
-                    networkConfigRegistry.getConfig(hostId, BasicHostConfig.class);
+            BasicHostConfig hostConfig = networkConfigRegistry.getConfig(hostId, BasicHostConfig.class);
             Set<IpAddress> ipAddresses = null;
             Set<HostLocation> locations = null;
 
             // Note: There will be no config presented in the CONFIG_REMOVE case
             if (hostConfig != null) {
                 ipAddresses = hostConfig.ipAddresses();
-                locations = hostConfig.locations().stream()
+                locations = hostConfig.locations();
+                if (locations == null || locations.size() < 1) {
+                    log.debug("Ignore network config event without host locations {}", event);
+                    return;
+                }
+                locations = locations.stream()
                         .map(hostLocation -> new HostLocation(hostLocation, System.currentTimeMillis()))
                         .collect(Collectors.toSet());
             }