adds null check and ensures that SetInternalRedirectPublishedContent cannot be called with a null result

This commit is contained in:
Shannon
2016-01-28 10:19:51 +01:00
parent e912238574
commit 81a99d6f7d
2 changed files with 5 additions and 4 deletions

View File

@@ -166,7 +166,8 @@ namespace Umbraco.Web.Routing
/// preserve or reset the template, if any.</remarks>
public void SetInternalRedirectPublishedContent(IPublishedContent content)
{
EnsureWriteable();
if (content == null) throw new ArgumentNullException("content");
EnsureWriteable();
// unless a template has been set already by the finder,
// template should be null at that point.

View File

@@ -515,11 +515,11 @@ namespace Umbraco.Web.Routing
{
// redirect to another page
var node = _routingContext.UmbracoContext.ContentCache.GetById(internalRedirectId);
_pcr.SetInternalRedirectPublishedContent(node); // don't use .PublishedContent here
if (node != null)
{
redirect = true;
_pcr.SetInternalRedirectPublishedContent(node); // don't use .PublishedContent here
redirect = true;
ProfilingLogger.Logger.Debug<PublishedContentRequestEngine>("{0}Redirecting to id={1}", () => tracePrefix, () => internalRedirectId);
}
else