This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 119b98623cc Fix: Avoid NPE if snapshotMgr failed during core init 
(#2879)
119b98623cc is described below

commit 119b98623cc47953111a64d9034af59726c9b9b8
Author: Andrey Bozhko <[email protected]>
AuthorDate: Thu Nov 21 15:52:35 2024 -0600

    Fix: Avoid NPE if snapshotMgr failed during core init (#2879)
    
    (cherry picked from commit 8de5721645344ffa4a34ea6886fcc9cd3d25b45a)
---
 solr/core/src/java/org/apache/solr/core/SolrCore.java | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java 
b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index a512d445bc6..205f5735c74 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1845,13 +1845,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;
+        }
       }
     }
 

Reply via email to