Protection when no active_person

svn: r19790
This commit is contained in:
Doug Blank
2012-06-08 01:19:21 +00:00
parent d42b5e2a3a
commit 49cf552b3f

View File

@@ -167,18 +167,19 @@ class PersonEvents(Events):
Display the events for the active person. Display the events for the active person.
""" """
active_person = self.dbstate.db.get_person_from_handle(active_handle) active_person = self.dbstate.db.get_person_from_handle(active_handle)
for event_ref in active_person.get_event_ref_list(): if active_person:
self.add_event_ref(event_ref) for event_ref in active_person.get_event_ref_list():
for family_handle in active_person.get_family_handle_list(): self.add_event_ref(event_ref)
family = self.dbstate.db.get_family_from_handle(family_handle) for family_handle in active_person.get_family_handle_list():
father_handle = family.get_father_handle() family = self.dbstate.db.get_family_from_handle(family_handle)
mother_handle = family.get_mother_handle() father_handle = family.get_father_handle()
if father_handle == active_handle: mother_handle = family.get_mother_handle()
spouse = self.dbstate.db.get_person_from_handle(mother_handle) if father_handle == active_handle:
else: spouse = self.dbstate.db.get_person_from_handle(mother_handle)
spouse = self.dbstate.db.get_person_from_handle(father_handle) else:
for event_ref in family.get_event_ref_list(): spouse = self.dbstate.db.get_person_from_handle(father_handle)
self.add_event_ref(event_ref, spouse) for event_ref in family.get_event_ref_list():
self.add_event_ref(event_ref, spouse)
self.set_has_data(self.model.count > 0) self.set_has_data(self.model.count > 0)
def get_start_date(self): def get_start_date(self):