mirror of https://github.com/apache/lucene.git
Prevent a NPE, when OffsetAttribute is not available.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@807216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
90ba4496ef
commit
5cd31d4683
|
@ -211,8 +211,12 @@ final class TermVectorsTermsWriterPerField extends TermsHashConsumerPerField {
|
||||||
p.freq = 1;
|
p.freq = 1;
|
||||||
|
|
||||||
if (doVectorOffsets) {
|
if (doVectorOffsets) {
|
||||||
int startOffset = fieldState.offset + offsetAttribute.startOffset();;
|
int startOffset = fieldState.offset;
|
||||||
int endOffset = fieldState.offset + offsetAttribute.endOffset();
|
int endOffset = fieldState.offset;
|
||||||
|
if (offsetAttribute != null) {
|
||||||
|
startOffset += offsetAttribute.startOffset();
|
||||||
|
endOffset += offsetAttribute.endOffset();
|
||||||
|
}
|
||||||
|
|
||||||
termsHashPerField.writeVInt(1, startOffset);
|
termsHashPerField.writeVInt(1, startOffset);
|
||||||
termsHashPerField.writeVInt(1, endOffset - startOffset);
|
termsHashPerField.writeVInt(1, endOffset - startOffset);
|
||||||
|
|
Loading…
Reference in New Issue