From 86432275f6185436b437c6320ba41cac4ed46f95 Mon Sep 17 00:00:00 2001 From: Daniel Naber Date: Fri, 20 Jul 2007 21:38:55 +0000 Subject: [PATCH] protect object against NPE in finally block, as an NPE here would hide the original exception git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@558160 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/index/IndexWriter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.