SOLR-6530: Protect against NPE when there are no live replicas

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1633276 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-10-21 06:10:18 +00:00
parent c1bdf27d97
commit 58fe66dba7
1 changed files with 6 additions and 4 deletions

View File

@ -850,10 +850,12 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
List<ZkCoreNodeProps> myReplicas = zkController.getZkStateReader().getReplicaProps(collection, List<ZkCoreNodeProps> myReplicas = zkController.getZkStateReader().getReplicaProps(collection,
cloudDesc.getShardId(), cloudDesc.getCoreNodeName()); cloudDesc.getShardId(), cloudDesc.getCoreNodeName());
boolean foundErrorNodeInReplicaList = false; boolean foundErrorNodeInReplicaList = false;
for (ZkCoreNodeProps replicaProp : myReplicas) { if (myReplicas != null) {
if (((Replica) replicaProp.getNodeProps()).getName().equals(((Replica)stdNode.getNodeProps().getNodeProps()).getName())) { for (ZkCoreNodeProps replicaProp : myReplicas) {
foundErrorNodeInReplicaList = true; if (((Replica) replicaProp.getNodeProps()).getName().equals(((Replica)stdNode.getNodeProps().getNodeProps()).getName())) {
break; foundErrorNodeInReplicaList = true;
break;
}
} }
} }