LUCENE-8709: Handle case of creating a HeapPointWriter with size equal 0

This commit is contained in:
iverase 2019-02-28 10:41:06 +01:00
parent 15f3c3b0e6
commit 5b2f064ba7
2 changed files with 12 additions and 2 deletions

View File

@ -37,7 +37,12 @@ public final class HeapPointReader implements PointReader {
curRead = start-1;
this.end = end;
this.packedBytesLength = packedBytesLength;
this.pointValue = new HeapPointValue(block, packedBytesLength);
if (start < end) {
this.pointValue = new HeapPointValue(block, packedBytesLength);
} else {
//no values
this.pointValue = new HeapPointValue(block, 0);
}
}
@Override

View File

@ -41,7 +41,12 @@ public final class HeapPointWriter implements PointWriter {
this.size = size;
this.packedBytesLength = packedBytesLength;
this.scratch = new byte[packedBytesLength];
offlinePointValue = new HeapPointReader.HeapPointValue(block, packedBytesLength);
if (size > 0) {
offlinePointValue = new HeapPointReader.HeapPointValue(block, packedBytesLength);
} else {
//no values
offlinePointValue = new HeapPointReader.HeapPointValue(block, 0);
}
}
/** Returns a reference, in <code>result</code>, to the byte[] slice holding this value */