Skip to content

Commit

Permalink
fix:When there are elements and the sum is indeed zero, there should …
Browse files Browse the repository at this point in the history
…be an average value returned instead of a null value.
  • Loading branch information
Uniplore-X committed Nov 26, 2024
1 parent b885214 commit 01d09de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/jsoncons_ext/jmespath/jmespath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ namespace jmespath {
sum += j.template as<double>();
}

return sum == 0 ? resources.null_value() : *resources.create_json(sum/arg0.size());
return arg0.size() == 0 ? resources.null_value() : *resources.create_json(sum / arg0.size());
}
};

Expand Down

0 comments on commit 01d09de

Please sign in to comment.