From 6bb98bb230e56502a65a3d892d5db902563b8412 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Thu, 10 Oct 2013 17:26:54 +0000 Subject: [PATCH] Fix for when active_handle is '' svn: r23297 --- gramps/plugins/gramplet/ancestor.py | 16 ++++++++-------- gramps/plugins/gramplet/descendant.py | 15 ++++++++------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/gramps/plugins/gramplet/ancestor.py b/gramps/plugins/gramplet/ancestor.py index f2751a7d5..1f41cc34e 100644 --- a/gramps/plugins/gramplet/ancestor.py +++ b/gramps/plugins/gramplet/ancestor.py @@ -77,14 +77,14 @@ class Ancestor(Gramplet): """ Return True if the gramplet has data, else return False. """ - if active_handle is None: - return False - person = self.dbstate.db.get_person_from_handle(active_handle) - family_handle = person.get_main_parents_family_handle() - family = self.dbstate.db.get_family_from_handle(family_handle) - if family and (family.get_father_handle() or - family.get_mother_handle()): - return True + if active_handle: + person = self.dbstate.db.get_person_from_handle(active_handle) + if person: + family_handle = person.get_main_parents_family_handle() + family = self.dbstate.db.get_family_from_handle(family_handle) + if family and (family.get_father_handle() or + family.get_mother_handle()): + return True return False def cb_double_click(self, treeview): diff --git a/gramps/plugins/gramplet/descendant.py b/gramps/plugins/gramplet/descendant.py index f2e18b211..c17d76e77 100644 --- a/gramps/plugins/gramplet/descendant.py +++ b/gramps/plugins/gramplet/descendant.py @@ -77,13 +77,14 @@ class Descendant(Gramplet): """ Return True if the gramplet has data, else return False. """ - if active_handle is None: - return False - person = self.dbstate.db.get_person_from_handle(active_handle) - for family_handle in person.get_family_handle_list(): - family = self.dbstate.db.get_family_from_handle(family_handle) - for child_ref in family.get_child_ref_list(): - return True + if active_handle: + person = self.dbstate.db.get_person_from_handle(active_handle) + if person: + for family_handle in person.get_family_handle_list(): + family = self.dbstate.db.get_family_from_handle(family_handle) + if family: + for child_ref in family.get_child_ref_list(): + return True return False def cb_double_click(self, treeview):