mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 23:53:27 +02:00
Don't crash if the prefs stored in the db are corrupted
This commit is contained in:
parent
952f03c18b
commit
59d91a44c7
1 changed files with 6 additions and 1 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
from calibre.constants import preferred_encoding
|
||||
from calibre.utils.config import to_json, from_json
|
||||
from calibre import prints
|
||||
|
||||
class DBPrefs(dict):
|
||||
|
||||
|
|
@ -17,7 +18,11 @@ def __init__(self, db):
|
|||
self.db = db
|
||||
self.defaults = {}
|
||||
for key, val in self.db.conn.get('SELECT key,val FROM preferences'):
|
||||
val = self.raw_to_object(val)
|
||||
try:
|
||||
val = self.raw_to_object(val)
|
||||
except:
|
||||
prints('Failed to read value for:', key, 'from db')
|
||||
continue
|
||||
dict.__setitem__(self, key, val)
|
||||
|
||||
def raw_to_object(self, raw):
|
||||
|
|
|
|||
Loading…
Reference in a new issue