diff --git a/src/Umbraco.Web.Common/Views/UmbracoViewPage.cs b/src/Umbraco.Web.Common/Views/UmbracoViewPage.cs index b1ac11c77d38..9ac8d917f568 100644 --- a/src/Umbraco.Web.Common/Views/UmbracoViewPage.cs +++ b/src/Umbraco.Web.Common/Views/UmbracoViewPage.cs @@ -39,21 +39,19 @@ public UmbracoHelper Umbraco return _helper; } + _helper = Context.RequestServices.GetRequiredService(); + TModel model = ViewData.Model; var content = model as IPublishedContent; + if (content is null && model is IContentModel contentModel) { content = contentModel.Content; } - if (content is null) - { - content = UmbracoContext?.PublishedRequest?.PublishedContent; - } - - _helper = Context.RequestServices.GetRequiredService(); + content ??= UmbracoContext?.PublishedRequest?.PublishedContent; - if (!(content is null)) + if (content is not null) { _helper.AssignedContentItem = content; }