Fix NPE when processing host events in UI

Change-Id: I2fb56911b38d36dafc12ee22c8e6ae250c7e6b35
diff --git a/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java b/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
index 36629f2..de4c816f 100644
--- a/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
+++ b/core/api/src/main/java/org/onosproject/ui/model/topo/UiRegion.java
@@ -30,7 +30,6 @@
 
 import static com.google.common.base.MoreObjects.toStringHelper;
 import static com.google.common.base.Strings.isNullOrEmpty;
-import static org.onosproject.net.DeviceId.deviceId;
 import static org.onosproject.net.region.RegionId.regionId;
 
 /**
@@ -354,9 +353,11 @@
                 return isLinkRelevant((UiLink) event.subject());
 
             case HOST_ADDED_OR_UPDATED:
+                final UiHost uiHost = (UiHost) event.subject();
                 if (MEMO_ADDED.equalsIgnoreCase(event.memo()) &&
+                        uiHost.regionId() != null &&
                         regionId.toString().equalsIgnoreCase(
-                          ((UiHost) event.subject()).regionId().toString())) {
+                                uiHost.regionId().toString())) {
                     return true;
                 } else {
                     return isDeviceRelevant(((UiDevice) event.subject()).id());