check for contents of bookmark files to improve migration

This commit is contained in:
Jakob Ketterl
2021-04-26 21:05:33 +02:00
parent 7962da9454
commit 5a60869f8e
2 changed files with 12 additions and 6 deletions

View File

@ -83,10 +83,11 @@ class Bookmarks(object):
def _loadBookmarks(self):
for file in self.fileList:
try:
f = open(file, "r")
bookmarks_json = json.load(f)
f.close()
return [Bookmark(d) for d in bookmarks_json]
with open(file, "r") as f:
content = f.read()
if content:
bookmarks_json = json.loads(content)
return [Bookmark(d) for d in bookmarks_json]
except FileNotFoundError:
pass
except json.JSONDecodeError: