Fix IsDuplicatedAncestorOf filter rule to avoid crash on tree loop (#714)

Fixes #10685
This commit is contained in:
Paul Culley 2018-11-27 21:06:43 -06:00 committed by Sam Manzi
parent 1d3202710a
commit 6506e85ea9

View File

@ -72,18 +72,15 @@ class IsDuplicatedAncestorOf(Rule):
f_id = fam.get_father_handle() f_id = fam.get_father_handle()
m_id = fam.get_mother_handle() m_id = fam.get_mother_handle()
if m_id: if m_id:
self.mother_side(db, db.get_person_from_handle(m_id)) self.go_deeper(db, db.get_person_from_handle(m_id))
if f_id: if f_id:
self.father_side(db, db.get_person_from_handle(f_id)) self.go_deeper(db, db.get_person_from_handle(f_id))
def mother_side(self, db, person): def go_deeper(self, db, person):
if person and person.handle in self.map:
self.map2.add((person.handle))
self.map.add((person.handle))
self.init_ancestor_list(db, person)
def father_side(self, db, person):
if person and person.handle in self.map: if person and person.handle in self.map:
self.map2.add((person.handle)) self.map2.add((person.handle))
# the following keeps from scanning same parts of tree multiple
# times and avoids crash on tree loops.
return
self.map.add((person.handle)) self.map.add((person.handle))
self.init_ancestor_list(db, person) self.init_ancestor_list(db, person)