8768: Gramps throws fatal error when trying to delete a family

This commit is contained in:
Doug Blank 2015-07-31 07:08:51 -04:00
parent f7280f13d7
commit f1cc01eb1a

View File

@ -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. Return a reference to a primary family event of the given event type.
""" """
from ..lib.eventroletype import EventRoleType from ..lib.eventroletype import EventRoleType
for event_ref in family.get_event_ref_list(): if family:
event = db.get_event_from_handle(event_ref.ref) for event_ref in family.get_event_ref_list():
if (event and event.get_type() == event_type and event = db.get_event_from_handle(event_ref.ref)
(event_ref.get_role() == EventRoleType.FAMILY or if (event and event.get_type() == event_type and
event_ref.get_role() == EventRoleType.PRIMARY)): (event_ref.get_role() == EventRoleType.FAMILY or
return event_ref event_ref.get_role() == EventRoleType.PRIMARY)):
return event_ref
return None return None
def get_primary_event_ref_list(db, family): def get_primary_event_ref_list(db, family):