patrickdemooij9 / SeoToolkit.Umbraco

SeoToolkit is a SEO package for Umbraco 9, 10, 11, 12 & 13. This package features most functionalities needed for your SEO needs like meta fields, sitemap, robots.txt and much more.
MIT License
35 stars 28 forks source link

Null reference exception on save new redirect #212

Closed kows closed 1 year ago

kows commented 1 year ago

As discussed on discord. Can't save a new redirect if there is an existing redirect for that url on a selected domain (customdomain is null).

https://github.com/patrickdemooij9/SeoToolkit.Umbraco/blob/d0408a97411574b95c73c7b709897fd5c9d0de2c/src/SeoToolkit.Umbraco.Redirects.Core/Services/RedirectsService.cs#L68C1-L69C1 "StackTrace": " at SeoToolkit.Umbraco.Redirects.Core.Services.RedirectsService.<>cDisplayClass5_0.<Save>b3(Redirect it)\r\n at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)\r\n at SeoToolkit.Umbraco.Redirects.Core.Services.RedirectsService.Save(Redirect redirect)\r\n at SeoToolkit.Umbraco.Redirects.Core.Controllers.RedirectsController.Save(SaveRedirectPostModel postModel)\r\n at lambda_method900(Closure , Object , Object[] )\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"

patrickdemooij9 commented 1 year ago

Fixed by PR