Skip to content

Apache Lucene open-source search software

SOLR-11484: fixing NPE

Noble Paulf1a6b68d75e5
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
index 772c74139c2..d746fe6b8a5 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java
@@ -922,10 +922,12 @@ public class CloudSolrClient extends SolrClient {
// so that the next attempt would fetch the fresh state
// just re-read state for all of them, if it has not been retried
// in retryExpiryTime time
- for (DocCollection ext : requestedCollections) {
- ExpiringCachedDocCollection cacheEntry = collectionStateCache.get(ext.getName());
- if (cacheEntry == null) continue;
- cacheEntry.maybeStale = true;
+ if (requestedCollections != null) {
+ for (DocCollection ext : requestedCollections) {
+ ExpiringCachedDocCollection cacheEntry = collectionStateCache.get(ext.getName());
+ if (cacheEntry == null) continue;
+ cacheEntry.maybeStale = true;
+ }
}
if (retryCount < MAX_STALE_RETRIES) {//if it is a communication error , we must try again
//may be, we have a stale version of the collection state