diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index f25e600fd1f..100967cc01b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -351,6 +351,9 @@ Bug Fixes * SOLR-8255: MiniSolrCloudCluster needs to use a thread-safe list to keep track of its child nodes (Alan Woodward) +* SOLR-8254: HttpSolrCore.getCoreByCollection() can throw NPE (Alan Woodward, + Mark Miller) + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java index e5329e093dc..e094bffc848 100644 --- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java +++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java @@ -783,10 +783,8 @@ public class HttpSolrCall { for (Map.Entry entry : entries) { // first see if we have the leader Replica leaderProps = clusterState.getLeader(collection, entry.getKey()); - if (liveNodes.contains(leaderProps.getNodeName()) && leaderProps.getState() == Replica.State.ACTIVE) { - if (leaderProps != null) { - core = checkProps(leaderProps); - } + if (leaderProps != null && liveNodes.contains(leaderProps.getNodeName()) && leaderProps.getState() == Replica.State.ACTIVE) { + core = checkProps(leaderProps); if (core != null) { return core; }