diff --git a/src/GitHubCostVisualizer.Web/Controllers/HomeController.cs b/src/GitHubCostVisualizer.Web/Controllers/HomeController.cs index a4d9dda..e1e4ac5 100644 --- a/src/GitHubCostVisualizer.Web/Controllers/HomeController.cs +++ b/src/GitHubCostVisualizer.Web/Controllers/HomeController.cs @@ -43,6 +43,11 @@ public IActionResult Report(HomeViewModel data) using (var csvData = new CsvReader(reader, CultureInfo.InvariantCulture)) { var rawReport = csvData.GetRecords().ToList(); + if (rawReport.Count == 0) + { + ModelState.AddModelError(nameof(data.UploadFile), "The uploaded file did not contain any records, please try with a different file."); + return View(nameof(Index), data); + } var model = _processor.ProcessUsageReport(rawReport); return View(model); }