Fix NPE caused by pushing events about nodes no longer in the cluster

Change-Id: I7a1da3d7824b07b446194d651ef4945f1305bce3
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
index e6163a9..1c6c7a7 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/DistributedClusterStore.java
@@ -258,6 +258,11 @@
     private void notifyStateChange(NodeId nodeId, State oldState, State newState) {
         if (oldState != newState) {
             ControllerNode node = allNodes.get(nodeId);
+            // Either this node or that node is no longer part of the same cluster
+            if (node == null) {
+                log.warn("Could not find node {} in the cluster, ignoring state change", node);
+                return;
+            }
             ClusterEvent.Type type = newState == State.READY ? INSTANCE_READY :
                     newState == State.ACTIVE ? INSTANCE_ACTIVATED :
                             INSTANCE_DEACTIVATED;
@@ -378,4 +383,4 @@
             log.warn(e.getMessage());
         }
     }
-}
\ No newline at end of file
+}