From de6847db7be46e3f97663927656e3c2ae10eabca Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 31 Jul 2015 07:08:51 -0400 Subject: [PATCH] 8768: Gramps throws fatal error when trying to delete a family --- gramps/gen/utils/db.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gramps/gen/utils/db.py b/gramps/gen/utils/db.py index 9853d839379..4e0a7f7d5cc 100644 --- a/gramps/gen/utils/db.py +++ b/gramps/gen/utils/db.py @@ -173,12 +173,13 @@ def get_event_ref(db, family, event_type): Return a reference to a primary family event of the given event type. """ from ..lib.eventroletype import EventRoleType - for event_ref in family.get_event_ref_list(): - event = db.get_event_from_handle(event_ref.ref) - if (event and event.get_type() == event_type and - (event_ref.get_role() == EventRoleType.FAMILY or - event_ref.get_role() == EventRoleType.PRIMARY)): - return event_ref + if family: + for event_ref in family.get_event_ref_list(): + event = db.get_event_from_handle(event_ref.ref) + if (event and event.get_type() == event_type and + (event_ref.get_role() == EventRoleType.FAMILY or + event_ref.get_role() == EventRoleType.PRIMARY)): + return event_ref return None def get_primary_event_ref_list(db, family):