Check for empty handle when returning default person

This commit is contained in:
Nick Hall 2015-12-13 19:27:49 +00:00
parent 5fc7dd6874
commit 0e8f335607

View File

@ -1488,12 +1488,16 @@ class DbBsddbRead(DbReadBase, Callback):
def get_default_person(self): def get_default_person(self):
"""Return the default Person of the database.""" """Return the default Person of the database."""
person = self.get_person_from_handle(self.get_default_handle()) person_handle = self.get_default_handle()
if person: if person_handle:
return person person = self.get_person_from_handle(person_handle)
elif (self.metadata is not None) and (not self.readonly): if person:
self.metadata[b'default'] = None return person
return None elif (self.metadata is not None) and (not self.readonly):
self.metadata[b'default'] = None
return None
else:
return None
def get_default_handle(self): def get_default_handle(self):
"""Return the default Person of the database.""" """Return the default Person of the database."""