Fix NPE in InternalGeoCentroidTests#testReduceRandom (#29481)
In some rare cases all inputs might have zero count and resulting in zero totalCount, and null in centroid causing NPE. Closes #29480
This commit is contained in:
parent
e0ec8571ea
commit
0aa19186ae
|
@ -68,8 +68,10 @@ public class InternalGeoCentroidTests extends InternalAggregationTestCase<Intern
|
|||
}
|
||||
totalCount += input.count();
|
||||
}
|
||||
if (totalCount > 0) {
|
||||
assertEquals(latSum/totalCount, reduced.centroid().getLat(), 1E-5D);
|
||||
assertEquals(lonSum/totalCount, reduced.centroid().getLon(), 1E-5D);
|
||||
}
|
||||
assertEquals(totalCount, reduced.count());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue