diff --git a/src/DataViews/_FamilyView.py b/src/DataViews/_FamilyView.py index 807cf1c16..d15da0901 100644 --- a/src/DataViews/_FamilyView.py +++ b/src/DataViews/_FamilyView.py @@ -694,19 +694,20 @@ class FamilyView(PageView.PersonNavView): dialog = SelectFamily(self.dbstate.db, _('Select Family')) family = dialog.run() - person = self.dbstate.db.get_person_from_handle(self.dbstate.active.handle) + if family: + person = self.dbstate.db.get_person_from_handle(self.dbstate.active.handle) - family.add_child_handle(person.handle) - - person.add_parent_family_handle( - family.handle, - (RelLib.Person.CHILD_BIRTH,''), - (RelLib.Person.CHILD_BIRTH,'')) - - trans = self.dbstate.db.transaction_begin() - self.dbstate.db.commit_person(person,trans) - self.dbstate.db.commit_family(family,trans) - self.dbstate.db.transaction_commit(trans,_("Add Family")) + family.add_child_handle(person.handle) + + person.add_parent_family_handle( + family.handle, + (RelLib.Person.CHILD_BIRTH,''), + (RelLib.Person.CHILD_BIRTH,'')) + + trans = self.dbstate.db.transaction_begin() + self.dbstate.db.commit_person(person,trans) + self.dbstate.db.commit_family(family,trans) + self.dbstate.db.transaction_commit(trans,_("Add Family")) def add_parent_family(self,obj,event,handle): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: