Improving null safety of GossipIntentStore peer update function

Change-Id: I4f517d899c98f7c6cd0964465dfbcebae17363a3
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
index a884e7a..310d366 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
@@ -195,7 +195,7 @@
         NodeId origin = (data != null) ? data.origin() : null;
         if (master == null || origin == null) {
             log.warn("Intent {} has no home; master = {}, origin = {}",
-                     data.key(), master, origin);
+                     key, master, origin);
         }
 
         NodeId me = clusterService.getLocalNode().id();
@@ -208,8 +208,8 @@
         } else if (isOrigin) {
             return master != null ? ImmutableList.of(master) : getRandomNode();
         } else {
-            log.warn("Not master or origin for intent {}", data.key());
-            return ImmutableList.of(master);
+            log.warn("Not master or origin for intent {}", key);
+            return master != null ? ImmutableList.of(master) : getRandomNode();
         }
     }