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
......