Adds try/catch block to allow method to fail open and log error.

This commit is contained in:
Johnny 2019-12-04 20:00:31 +00:00
parent e38f3ff56d
commit 8785523c72

View file

@ -216,13 +216,16 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase):
@property
def characters(self):
# Get playable characters list
objs = self.db._playable_characters
if not objs: objs = ()
objs = self.db._playable_characters or []
# Rebuild the list if legacy code left null values after deletion
if None in objs:
objs = [x for x in self.db._playable_characters if x]
self.db._playable_characters = objs
try:
if None in objs:
objs = [x for x in self.db._playable_characters if x]
self.db._playable_characters = objs
except Exception as e:
logger.log_trace(e)
logger.log_err(e)
return objs