From 3baae5ab535f9503c02353dced5ffe864c59286a Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 25 Jul 2022 18:02:40 +0200 Subject: [PATCH] Check if content has an identity before attempting to get it's ancestors (#12733) * Check if content has an identity before attempting to get it's ancestors * Check if we even need to go to the parent * Fail earlier * Update src/Umbraco.Web.BackOffice/Controllers/ContentController.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> --- src/Umbraco.Web.BackOffice/Controllers/ContentController.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs b/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs index 0d45185eb9..1ca12f2f42 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/ContentController.cs @@ -1797,6 +1797,11 @@ public class ContentController : ContentControllerBase private IEnumerable GetPublishedCulturesFromAncestors(IContent? content) { + if (content?.ParentId is not -1 && content?.HasIdentity is false) + { + content = _contentService.GetById(content.ParentId); + } + if (content?.ParentId == -1) { return content.PublishedCultures;