mirror of https://github.com/apache/lucene.git
LUCENE-8709: Handle case of creating a HeapPointWriter with size equal 0
This commit is contained in:
parent
15f3c3b0e6
commit
5b2f064ba7
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue