fix npe in clusterMasterNodeExpression

masterNodeId can be null for example if there aren't enough
nodes to form a cluster due to the minimum_master_nodes
setting

(cherry picked from commit e786c9ebc2e41eecab6559aee11851eb7580dcd7)