Fix PublishedSnapshotAccessor to not throw but return null

This commit is contained in:
Stephan
2018-05-29 16:42:21 +02:00
parent 518ccd5686
commit 3da596eedf

View File

@@ -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
}
}
}