From 24378116a72da10fe687ac8515782bbec50e4791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Mon, 2 Aug 2021 22:12:54 +0200 Subject: [PATCH] #408 - Fix summary when only fixed expenses are present. --- src/Money.Blazor.Host/Pages/Summary.razor.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Money.Blazor.Host/Pages/Summary.razor.cs b/src/Money.Blazor.Host/Pages/Summary.razor.cs index 0b4c2772..5957a7a5 100644 --- a/src/Money.Blazor.Host/Pages/Summary.razor.cs +++ b/src/Money.Blazor.Host/Pages/Summary.razor.cs @@ -179,8 +179,10 @@ private void Sort() protected string GetPercentualValue(CategoryWithAmountModel category) { + decimal percentage = 0; decimal total = Categories.Sum(c => c.TotalAmount.Value); - decimal percentage = 100 / total * category.TotalAmount.Value; + if (total != 0) + percentage = 100 / total * category.TotalAmount.Value; return percentage.ToString("0.##", CultureInfo.InvariantCulture); }