Madan Jampani

Fixes NPE in ConsistentDeviceMastershipStore

Change-Id: Id07c8d41338a48e58d7e3ea98312691a2011eeef
......@@ -236,7 +236,8 @@ public class ConsistentDeviceMastershipStore
String leadershipTopic = createDeviceMastershipTopic(deviceId);
Leadership leadership = leadershipService.getLeadership(leadershipTopic);
return leadership != null ? MastershipTerm.of(leadership.leaderNodeId(), leadership.leader().term()) : null;
return leadership != null && leadership.leaderNodeId() != null ?
MastershipTerm.of(leadership.leaderNodeId(), leadership.leader().term()) : null;
}
@Override
......@@ -349,4 +350,4 @@ public class ConsistentDeviceMastershipStore
Matcher m = DEVICE_MASTERSHIP_TOPIC_PATTERN.matcher(topic);
return m.matches();
}
}
\ No newline at end of file
}
......