Fix: do not propagate PORT_REMOVED event if the event has null value

Change-Id: I0cfe520a8910e7aea6b182836deb6dc8469c8e7c
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/DistributedK8sNetworkStore.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/DistributedK8sNetworkStore.java
index 9117e31..301aa0e 100644
--- a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/DistributedK8sNetworkStore.java
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/DistributedK8sNetworkStore.java
@@ -262,10 +262,17 @@
                     break;
                 case REMOVE:
                     log.debug("Kubernetes port removed");
-                    notifyDelegate(new K8sNetworkEvent(
-                            K8S_PORT_REMOVED,
-                            network(event.oldValue().value().networkId()),
-                            event.oldValue().value()));
+
+                    // if the event object has invalid port value, we do not
+                    // propagate K8S_PORT_REMOVED event.
+                    if (event.oldValue() != null &&
+                            event.oldValue().value() != null) {
+                        notifyDelegate(new K8sNetworkEvent(
+                                K8S_PORT_REMOVED,
+                                network(event.oldValue().value().networkId()),
+                                event.oldValue().value()));
+                    }
+
                     break;
                 default:
                     // do nothing