Skip to content

Commit 58e4c6b

Browse files
committed
Fix bug in summary function when SQL returns null because there are no rows
1 parent d11986b commit 58e4c6b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Griddly.Mvc/Results/QueryableResult.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,14 @@ internal void PopulateSummaryValue(GriddlyColumn c)
8484
case SummaryAggregateFunction.Average:
8585
case SummaryAggregateFunction.Min:
8686
case SummaryAggregateFunction.Max:
87-
c.SummaryValue = _result.Aggregate(c.SummaryFunction.Value.ToString(), c.ExpressionString);
88-
87+
try
88+
{
89+
c.SummaryValue = _result.Aggregate(c.SummaryFunction.Value.ToString(), c.ExpressionString);
90+
}
91+
catch
92+
{
93+
c.SummaryValue = null;
94+
}
8995
break;
9096

9197
default:

0 commit comments

Comments
 (0)