Apache Solr open-source search software
Fix: Avoid NPE if snapshotMgr failed during core init (#2879)
Andrey Bozhko8de572164534
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.javaindex 55325568abe..749436a0e8c 100644--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java@@ -1838,13 +1838,15 @@ public class SolrCore implements SolrInfoBean, Closeable {}// Close the snapshots meta-data directory.- Directory snapshotsDir = snapshotMgr.getSnapshotsDir();- try {- this.directoryFactory.release(snapshotsDir);- } catch (Throwable e) {- log.error("Exception releasing snapshotsDir {}", snapshotsDir, e);- if (e instanceof Error) {- throw (Error) e;+ if (snapshotMgr != null) {+ Directory snapshotsDir = snapshotMgr.getSnapshotsDir();+ try {+ this.directoryFactory.release(snapshotsDir);+ } catch (Throwable e) {+ log.error("Exception releasing snapshotsDir {}", snapshotsDir, e);+ if (e instanceof Error) {+ throw (Error) e;+ }}}