diff --git a/gramps/gen/utils/db.py b/gramps/gen/utils/db.py index 4e0a7f7d5..8725413c8 100644 --- a/gramps/gen/utils/db.py +++ b/gramps/gen/utils/db.py @@ -393,8 +393,9 @@ def find_children(db,p): childlist = [] for family_handle in p.get_family_handle_list(): family = db.get_family_from_handle(family_handle) - for child_ref in family.get_child_ref_list(): - childlist.append(child_ref.ref) + if family: + for child_ref in family.get_child_ref_list(): + childlist.append(child_ref.ref) return childlist #------------------------------------------------------------------------- @@ -522,10 +523,14 @@ def preset_name(basepers, name, sibling=False): def family_name(family, db, noname=_("unknown")): """Builds a name for the family from the parents names""" + father = None + mother = None father_handle = family.get_father_handle() mother_handle = family.get_mother_handle() - father = db.get_person_from_handle(father_handle) - mother = db.get_person_from_handle(mother_handle) + if father_handle: + father = db.get_person_from_handle(father_handle) + if mother_handle: + mother = db.get_person_from_handle(mother_handle) if father and mother: fname = name_displayer.display(father) mname = name_displayer.display(mother)