Adds some null checks, need to see if tests pass

This commit is contained in:
Shannon
2020-04-01 11:06:21 +11:00
parent 5fc889a8a5
commit f1b398fab6
2 changed files with 9 additions and 2 deletions

View File

@@ -1028,8 +1028,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
{
parentLink = parentLink ?? GetRequiredParentLink(content, null);
// TODO: This can result in a null value? see https://github.com/umbraco/Umbraco-CMS/issues/7868
// It seems to be related to having corrupt Paths in the umbracoNode table.
var parent = parentLink.Value;
if (parent == null)
throw new PanicException($"A null Value was returned on the {nameof(parentLink)} LinkedNode with id={content.ParentContentId}, potentially your database paths are corrupted, please see the HealthCheck dashboard and fixup data inconsistencies.");
// if parent has no children, clone parent + add as first child
if (parent.FirstChildContentId < 0)
{

View File

@@ -1,4 +1,6 @@
namespace Umbraco.Web.PublishedCache.NuCache.Snap
using System;
namespace Umbraco.Web.PublishedCache.NuCache.Snap
{
//NOTE: This cannot be struct because it references itself
@@ -11,7 +13,7 @@
{
public LinkedNode(TValue value, long gen, LinkedNode<TValue> next = null)
{
Value = value;
Value = value ?? throw new ArgumentNullException(nameof(value));
Gen = gen;
Next = next;
}