From 9e1fd04733efc8f5e91acdf29f2a7cb2ec4bd973 Mon Sep 17 00:00:00 2001 From: airborne12 Date: Fri, 10 May 2024 20:03:16 +0800 Subject: [PATCH] [Fix](index writer) fix core if docWriter nullptr when IndexWriter doFlush (#213) --- src/core/CLucene/index/IndexWriter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/CLucene/index/IndexWriter.cpp b/src/core/CLucene/index/IndexWriter.cpp index e6a0887..e2e6ae7 100644 --- a/src/core/CLucene/index/IndexWriter.cpp +++ b/src/core/CLucene/index/IndexWriter.cpp @@ -2048,6 +2048,11 @@ void IndexWriter::flush(bool triggerMerge, bool _flushDocStores) { bool IndexWriter::doFlush(bool _flushDocStores) { SCOPED_LOCK_MUTEX(THIS_LOCK) + // if docWriter is nullptr, maybe it's been flushed already + if (docWriter == nullptr) { + return false; + } + // Make sure no threads are actively adding a document // Returns true if docWriter is currently aborting, in