From 378d9efe0ceaf339b71b7aee95d4882519a94150 Mon Sep 17 00:00:00 2001 From: Marco Baccarani Date: Fri, 31 Jul 2020 16:30:10 +0200 Subject: [PATCH] Bugfix crash on statistics when an FDL doesnt have any attached timesheets --- Great/ViewModels/StatisticsViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Great/ViewModels/StatisticsViewModel.cs b/Great/ViewModels/StatisticsViewModel.cs index 1a1e4b3..54332e5 100644 --- a/Great/ViewModels/StatisticsViewModel.cs +++ b/Great/ViewModels/StatisticsViewModel.cs @@ -687,7 +687,7 @@ private void LoadExpensesData() var expenses = db.ExpenseAccounts.Where(ea => ea.FDL1.StartDay >= startDate && ea.FDL1.StartDay <= endDate && ea.Status == 2).ToList() .Select(e => new { - day = new DayEVM(e.FDL1.Timesheets.FirstOrDefault().Day), + day = new DayEVM(db.Days.SingleOrDefault(d => d.Timestamp == e.FDL1.StartDay)), expense = new ExpenseAccountEVM(e) });