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>
This commit is contained in:
Sebastiaan Janssen
2022-07-25 18:02:40 +02:00
committed by Nikolaj Geisle
parent aabb6c2665
commit 3baae5ab53

View File

@@ -1797,6 +1797,11 @@ public class ContentController : ContentControllerBase
private IEnumerable<string> 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;