Fixes: U4-3051 GetAncestorOrSelfDocuments gets stuck in infinite loop
Merge pull request #244 from leekelleher/U4-3051

Fixes: U4-3051 GetAncestorOrSelfDocuments gets stuck in infinite loop