Fixes: U4-3051 GetAncestorOrSelfDocuments gets stuck in infinite loop

This commit is contained in:
leekelleher
2013-11-12 21:26:21 +00:00
parent 181593f5ea
commit cfcfb75dcc
2 changed files with 2 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ namespace umbraco
public static IEnumerable<Document> GetAncestorDocuments(this Document document)
{
var ancestor = uQuery.GetDocument(document.ParentId);
while (ancestor != null)
while (ancestor != null && ancestor.Id != -1)
{
yield return ancestor;

View File

@@ -21,7 +21,7 @@ namespace umbraco
{
var ancestor = new Media(media.Parent.Id);
while (ancestor != null)
while (ancestor != null && ancestor.Id != -1)
{
yield return ancestor;