Skip to content

Apache Lucene open-source search software

SOLR-5474 NPE in tests

Noble Paul346e8f52bd5e
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
index 05cbe50fdb8..7e429ed973d 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
@@ -703,7 +703,11 @@ public class CloudSolrServer extends SolrServer {
// if we experienced a communication error, it's worth checking the state
// with ZK just to make sure the node we're trying to hit is still part of the collection
- if (retryCount < MAX_STALE_RETRIES && !stateWasStale && !requestedCollections.isEmpty() && wasCommError) {
+ if (retryCount < MAX_STALE_RETRIES &&
+ !stateWasStale &&
+ requestedCollections != null &&
+ !requestedCollections.isEmpty() &&
+ wasCommError) {
for (DocCollection ext : requestedCollections) {
DocCollection latestStateFromZk = getDocCollection(zkStateReader.getClusterState(), ext.getName());
if (latestStateFromZk.getZNodeVersion() != ext.getZNodeVersion()) {