diff --git a/projects/GKCore/GKCore/Charts/TreeChartModel.cs b/projects/GKCore/GKCore/Charts/TreeChartModel.cs index 2b54ca5c5..09251a0e8 100644 --- a/projects/GKCore/GKCore/Charts/TreeChartModel.cs +++ b/projects/GKCore/GKCore/Charts/TreeChartModel.cs @@ -2341,9 +2341,8 @@ public List GetAncestors(TreeChartPerson person) private void GetAncestors(TreeChartPerson person, HashSet ancestors) { - if (person == null || person.Rec == null) return; - - ancestors.Add(person.Rec); + if (person == null) return; + if (person.Rec != null) ancestors.Add(person.Rec); if (person.Father != null) GetAncestors(person.Father, ancestors); if (person.Mother != null) GetAncestors(person.Mother, ancestors); @@ -2358,7 +2357,8 @@ public List GetDescendants(TreeChartPerson person) private void GetDescendants(TreeChartPerson person, HashSet descendants) { - if (person == null || person.Rec == null) return; + if (person == null) return; + if (person.Rec != null) descendants.Add(person.Rec); int childrenCount = person.GetChildsCount(); for (int i = 0; i < childrenCount; i++) {