From 94cb6cb66843f0fb435f62ea0afa69d76a5e14ef Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 14 Feb 2019 08:03:00 +0100 Subject: [PATCH] Bugfix NuCache #4547 --- .../PublishedCache/NuCache/ContentNodeKit.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); } } }