From 2554b89ed2ef3ba02466b1d1c1f10b4117301478 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Mon, 16 Aug 2021 14:12:00 +0200 Subject: [PATCH] Fix SharedTrip 500 error --- bahnplan.web/Pages/SharedTrip.cshtml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bahnplan.web/Pages/SharedTrip.cshtml.cs b/bahnplan.web/Pages/SharedTrip.cshtml.cs index f8c10fa..8ce060c 100644 --- a/bahnplan.web/Pages/SharedTrip.cshtml.cs +++ b/bahnplan.web/Pages/SharedTrip.cshtml.cs @@ -13,8 +13,10 @@ namespace bahnplan.web.Pages { public void OnGet() { using var db = new Database.DbConn(); - if (!db.Legs.Any(p => p.TripId == int.Parse(Request.Query["id"]))) + if (!db.Legs.Any(p => p.TripId == int.Parse(Request.Query["id"]))) { RedirToIndex = true; + return; + } Legs = db.Legs.Where(p => p.TripId == int.Parse(Request.Query["id"])).OrderBy(p => p.DepTime).ToList(); User = db.Users.First(p => p.UserId == Legs.First().UserId).Username;