diff --git a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java index 37580e02b44..d798c2202b8 100644 --- a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java @@ -68,9 +68,12 @@ public abstract class PointRangeQuery extends Query { if (lowerPoint.length % numDims != 0) { throw new IllegalArgumentException("lowerPoint is not a fixed multiple of numDims"); } - if (upperPoint.length != upperPoint.length) { + if (lowerPoint.length != upperPoint.length) { throw new IllegalArgumentException("lowerPoint has length=" + numDims + " but upperPoint has different length=" + upperPoint.length); } + if (numDims <= 0) { + throw new IllegalArgumentException("numDims must be positive, got " + numDims); + } this.numDims = numDims; this.bytesPerDim = lowerPoint.length / numDims;