From 8967051444b73eaeaff3ca66e158a89960bcf5f2 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sat, 16 Dec 2023 10:01:56 +0330 Subject: [PATCH] #418 trying to find an issue --- .../GanjoorService-Partials/GanjoorService-QuotedPoems.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-QuotedPoems.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-QuotedPoems.cs index ba9e6784..c22df4cd 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-QuotedPoems.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-QuotedPoems.cs @@ -336,7 +336,11 @@ namespace RMuseum.Services.Implementation var poem2 = await context.GanjoorPoems.AsNoTracking().Where(p => p.FullUrl == poem2Url).SingleOrDefaultAsync(); if (poem2 == null) { - var redirectedPage = await context.GanjoorPages.AsNoTracking().Where(p => p.RedirectFromFullUrl == poem2Url).SingleAsync(); + var redirectedPage = await context.GanjoorPages.AsNoTracking().Where(p => p.RedirectFromFullUrl == poem2Url).SingleOrDefaultAsync(); + if(redirectedPage == null) + { + return new RServiceResult(false, poem2Url); + } poem2 = await context.GanjoorPoems.AsNoTracking().Where(p => p.Id == redirectedPage.Id).SingleAsync(); }