diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs index 739a6141be..753ba5cc94 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNodeKit.cs @@ -24,7 +24,18 @@ namespace Umbraco.Web.PublishedCache.NuCache bool canBePublished, IUmbracoContextAccessor umbracoContextAccessor) { - Node.SetContentTypeAndData(contentType, DraftData, canBePublished ? PublishedData : null, publishedSnapshotAccessor, variationContextAccessor,umbracoContextAccessor); + var draftData = DraftData; + + // no published data if it cannot be published (eg is masked) + var publishedData = canBePublished ? PublishedData : null; + + // we *must* have either published or draft data + // if it cannot be published, published data is going to be null + // therefore, ensure that draft data is not + if (draftData == null && !canBePublished) + draftData = PublishedData; + + Node.SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationContextAccessor,umbracoContextAccessor); } } } diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs index 123cb952d7..a7de6ca842 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs @@ -278,7 +278,10 @@ namespace Umbraco.Web.Runtime { "compositeFileHandlerPath", ClientDependencySettings.Instance.CompositeFileHandlerPath } }); - ClientDependencySettings.Instance.MvcRendererCollection.Add(renderer); + // When using a non-web runtime and this component is loaded ClientDependency explodes because it'll + // want to access HttpContext.Current, which doesn't exist + if (IOHelper.IsHosted) + ClientDependencySettings.Instance.MvcRendererCollection.Add(renderer); } } }