Prevent crash from exporting because of no default person.
Because of changes in [1], if self.get_default_handle() doesn't return a handle, we would have a crash.
5c958bd7fb
This commit is contained in:
parent
7710544936
commit
03a72b8319
@ -476,14 +476,18 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
@catch_db_error
|
@catch_db_error
|
||||||
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) and (not self.readonly):
|
if person:
|
||||||
# Start transaction
|
return person
|
||||||
with BSDDBTxn(self.env, self.metadata) as txn:
|
elif (self.metadata) and (not self.readonly):
|
||||||
txn.put(b'default', None)
|
# Start transaction
|
||||||
return None
|
with BSDDBTxn(self.env, self.metadata) as txn:
|
||||||
|
txn.put(b'default', None)
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def set_mediapath(self, path):
|
def set_mediapath(self, path):
|
||||||
"""Set the default media path for database, path should be utf-8."""
|
"""Set the default media path for database, path should be utf-8."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user