Avoid NullPointerException when removing primary from a replica set

getPrimary() checks all members but the entity that /was/ the primary
has been removed from the group by the time this log statement is reached.
If the set hasn't chosen a new primary and the sensors haven't updated
this causes a NullPointerException.