Skip to content

Commit

Permalink
fix(QueryBuilder): Return 0 on null aggregates
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Jul 10, 2020
1 parent 2f401e5 commit ee10a67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/Query/QueryBuilder.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2844,15 +2844,15 @@ component displayname="QueryBuilder" accessors="true" {
*
* @return any
*/
private function withAggregate( required struct aggregate, required any callback ) {
private numeric function withAggregate( required struct aggregate, required any callback ) {
var originalAggregate = getAggregate();
var originalOrders = getOrders();
setAggregate( arguments.aggregate );
setOrders( [] );
var result = callback();
setAggregate( originalAggregate );
setOrders( originalOrders );
return result;
return isNumeric( result ) ? result : 0;
}

/**
Expand Down

0 comments on commit ee10a67

Please sign in to comment.