diff --git a/src/java/org/apache/lucene/index/SegmentReader.java b/src/java/org/apache/lucene/index/SegmentReader.java index aea1b636f43..73373f02194 100644 --- a/src/java/org/apache/lucene/index/SegmentReader.java +++ b/src/java/org/apache/lucene/index/SegmentReader.java @@ -489,6 +489,9 @@ class SegmentReader extends IndexReader { return null; TermVectorsReader termVectorsReader = getTermVectorsReader(); + if (termVectorsReader == null) + return null; + return termVectorsReader.get(docNumber, field); } @@ -505,6 +508,9 @@ class SegmentReader extends IndexReader { return null; TermVectorsReader termVectorsReader = getTermVectorsReader(); + if (termVectorsReader == null) + return null; + return termVectorsReader.get(docNumber); } } diff --git a/src/java/org/apache/lucene/index/TermVectorsReader.java b/src/java/org/apache/lucene/index/TermVectorsReader.java index 96de61c2886..6cfc57eca7c 100644 --- a/src/java/org/apache/lucene/index/TermVectorsReader.java +++ b/src/java/org/apache/lucene/index/TermVectorsReader.java @@ -295,6 +295,10 @@ class TermVectorsReader implements Cloneable { } protected Object clone() { + + if (tvx == null || tvd == null || tvf == null) + return null; + TermVectorsReader clone = null; try { clone = (TermVectorsReader) super.clone();