Skip to content

Commit

Permalink
Add null check the preview url router
Browse files Browse the repository at this point in the history
ContentRouteData will not be returned in case router
fails to map an URL instance to a particular content data.

Closes #234
  • Loading branch information
barteksekula committed May 5, 2023
1 parent b14ceb3 commit 2a0792a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Advanced.CMS.ExternalReviews/PreviewUrlResolver.cs
Expand Up @@ -169,6 +169,11 @@ public ContentRouteData Route(UrlBuilder urlBuilder, RouteArguments routeArgumen
{
var contentRouteData = _defaultUrlResolver.Route(urlBuilder, routeArguments);

if (contentRouteData?.RemainingPath == null)
{
return contentRouteData;
}

if (contentRouteData.RemainingPath.StartsWith($"{_externalReviewOptions.Service.ContentPreviewUrl}/", StringComparison.CurrentCultureIgnoreCase))
{
// If we failed to route then it means that a start page in the same language does not exist and our partial routers will not be able to step in
Expand Down

0 comments on commit 2a0792a

Please sign in to comment.