diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.java index 0901de9748c..02826ada590 100644 --- a/src/java/org/apache/lucene/index/IndexWriter.java +++ b/src/java/org/apache/lucene/index/IndexWriter.java @@ -2273,7 +2273,9 @@ public class IndexWriter { } } finally { // close readers before we attempt to delete now-obsolete segments - merger.closeReaders(); + if (merger != null) { + merger.closeReaders(); + } } // Give deleter a chance to remove files now.