Fix NPE in InternalGeoCentroidTests#testReduceRandom
In some rare cases all inputs might have zero count and resulting in
zero totalCount, and null in centroid causing NPE.
Closes
@@ -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());
}
