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)
{