Merge pull request from dadav/fix/empty_brain

Empty brain leads to crash
This commit is contained in:
evilsocket 2019-09-29 21:21:06 +02:00 committed by GitHub
commit 91db2feace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,7 +54,7 @@ class Stats(object):
def load(self):
with self._lock:
if os.path.exists(self.path):
if os.path.exists(self.path) and os.path.getsize(self.path) > 0:
core.log("[ai] loading %s" % self.path)
with open(self.path, 'rt') as fp:
obj = json.load(fp)