mirror of https://github.com/apache/lucene.git
LUCENE-8196: Check for a null input in LowpassIntervalsSource
This commit is contained in:
parent
34b83ed869
commit
7117b68db6
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.lucene.search.intervals;
|
package org.apache.lucene.search.intervals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps an {@link IntervalIterator} and passes through those intervals that match the {@link #accept()} function
|
* Wraps an {@link IntervalIterator} and passes through those intervals that match the {@link #accept()} function
|
||||||
|
@ -30,7 +31,7 @@ public abstract class IntervalFilter extends IntervalIterator {
|
||||||
* Create a new filter
|
* Create a new filter
|
||||||
*/
|
*/
|
||||||
public IntervalFilter(IntervalIterator in) {
|
public IntervalFilter(IntervalIterator in) {
|
||||||
this.in = in;
|
this.in = Objects.requireNonNull(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -56,6 +56,9 @@ class LowpassIntervalsSource extends IntervalsSource {
|
||||||
@Override
|
@Override
|
||||||
public IntervalIterator intervals(String field, LeafReaderContext ctx) throws IOException {
|
public IntervalIterator intervals(String field, LeafReaderContext ctx) throws IOException {
|
||||||
IntervalIterator i = in.intervals(field, ctx);
|
IntervalIterator i = in.intervals(field, ctx);
|
||||||
|
if (i == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new IntervalFilter(i) {
|
return new IntervalFilter(i) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean accept() {
|
protected boolean accept() {
|
||||||
|
|
Loading…
Reference in New Issue