Mercurial > dovecot > core-2.2
changeset 13160:ed4f9475fa32
fts-lucene: Don't crash if optimize can't open the index.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 04 Aug 2011 14:12:30 +0300 |
parents | 4a537b1c32d4 |
children | 7481ea45b95f |
files | src/plugins/fts-lucene/lucene-wrapper.cc |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/fts-lucene/lucene-wrapper.cc Thu Aug 04 14:12:11 2011 +0300 +++ b/src/plugins/fts-lucene/lucene-wrapper.cc Thu Aug 04 14:12:30 2011 +0300 @@ -450,15 +450,16 @@ if (IndexReader::isLocked(index->path)) IndexReader::unlock(index->path); - IndexWriter *writer = - _CLNEW IndexWriter(index->path, index->analyzer, false); + IndexWriter *writer = NULL; try { + writer = _CLNEW IndexWriter(index->path, index->analyzer, false); writer->optimize(); } catch (CLuceneError &err) { lucene_handle_error(index, err, "IndexWriter::optimize()"); ret = -1; } - _CLDELETE(writer); + if (writer != NULL) + _CLDELETE(writer); return ret; }