Nucache NullReferenceException when copying (#7961)

(cherry picked from commit b30db05cc7)

# Conflicts:
#	src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
This commit is contained in:
Shannon Deminick
2020-04-16 04:51:13 +10:00
committed by Sebastiaan Janssen
parent 055f18d639
commit 4a071f6e05
2 changed files with 91 additions and 28 deletions

View File

@@ -873,9 +873,11 @@ namespace Umbraco.Web.PublishedCache.NuCache
var id = content.FirstChildContentId;
while (id > 0)
{
// get the required link node, this ensures that both `link` and `link.Value` are not null
var link = GetRequiredLinkedNode(id, "child", null);
ClearBranchLocked(link.Value);
id = link.Value.NextSiblingContentId;
var linkValue = link.Value; // capture local since clearing in recurse can clear it
ClearBranchLocked(linkValue); // recurse
id = linkValue.NextSiblingContentId;
}
}