4694: Tools->Utilities->Verify the Data->crash

svn: r16728
This commit is contained in:
Doug Blank 2011-02-28 13:50:54 +00:00
parent 2933de5d2f
commit db8402e7f5

View File

@ -119,21 +119,25 @@ def get_date_from_event_handle(db,event_handle):
if not event_handle: if not event_handle:
return 0 return 0
event = find_event(db,event_handle) event = find_event(db,event_handle)
date_obj = event.get_date_object() if event:
if date_obj.get_day() == 0 or date_obj.get_month() == 0: date_obj = event.get_date_object()
if date_obj.get_day() == 0 or date_obj.get_month() == 0:
return 0
return date_obj.get_sort_value()
else:
return 0 return 0
return date_obj.get_sort_value()
def get_date_from_event_type(db,person,event_type): def get_date_from_event_type(db,person,event_type):
if not person: if not person:
return 0 return 0
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
event = find_event(db,event_ref.ref) event = find_event(db,event_ref.ref)
if event.get_type() == event_type: if event:
date_obj = event.get_date_object() if event.get_type() == event_type:
if date_obj.get_day() == 0 or date_obj.get_month() == 0: date_obj = event.get_date_object()
return 0 if date_obj.get_day() == 0 or date_obj.get_month() == 0:
return date_obj.get_sort_value() return 0
return date_obj.get_sort_value()
return 0 return 0
def get_bapt_date(db,person): def get_bapt_date(db,person):
@ -143,7 +147,7 @@ def get_bury_date(db,person):
# check role on burial event # check role on burial event
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
event = find_event(db, event_ref.ref) event = find_event(db, event_ref.ref)
if event.get_type() == gen.lib.EventType.BURIAL and \ if event and event.get_type() == gen.lib.EventType.BURIAL and \
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY: event_ref.get_role() == gen.lib.EventRoleType.PRIMARY:
return get_date_from_event_type(db,person,gen.lib.EventType.BURIAL) return get_date_from_event_type(db,person,gen.lib.EventType.BURIAL)