Skip to content

Commit

Permalink
fix(android): allow null value for average
Browse files Browse the repository at this point in the history
  • Loading branch information
russellwheatley committed Nov 7, 2024
1 parent 148cfb1 commit de34cc2
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,12 @@ public void aggregateQuery(
break;
case "average":
Number average = snapshot.get(average(Objects.requireNonNull(field)));
result.putDouble(
Objects.requireNonNull(key),
Objects.requireNonNull(average).doubleValue());
String averageKey = Objects.requireNonNull(key);
if (average == null) {
result.putNull(averageKey);
} else {
result.putDouble(averageKey, Objects.requireNonNull(average).doubleValue());
}
break;
default:
throw new Error("Invalid AggregateType: " + aggType);
Expand Down

0 comments on commit de34cc2

Please sign in to comment.