From 3da596eedffd3d891b3a423b4e53027729cc1bfb Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 29 May 2018 16:42:21 +0200 Subject: [PATCH] Fix PublishedSnapshotAccessor to not throw but return null --- .../UmbracoContextPublishedSnapshotAccessor.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/UmbracoContextPublishedSnapshotAccessor.cs b/src/Umbraco.Web/PublishedCache/UmbracoContextPublishedSnapshotAccessor.cs index 706d67020a..76936dd2cb 100644 --- a/src/Umbraco.Web/PublishedCache/UmbracoContextPublishedSnapshotAccessor.cs +++ b/src/Umbraco.Web/PublishedCache/UmbracoContextPublishedSnapshotAccessor.cs @@ -16,14 +16,10 @@ namespace Umbraco.Web.PublishedCache get { var umbracoContext = _umbracoContextAccessor.UmbracoContext; - if (umbracoContext == null) throw new Exception("The IUmbracoContextAccessor could not provide an UmbracoContext."); - return umbracoContext.PublishedSnapshot; + return umbracoContext?.PublishedSnapshot; } - set - { - throw new NotSupportedException(); // not ok to set - } + set => throw new NotSupportedException(); // not ok to set } } }