Edit Book: Fix error when trying to add words to user dictionary for a book with a language that has no dictionary available. Fixes #1517928 [problem with spellchecker](https://bugs.launchpad.net/calibre/+bug/1517928) [problem with spellchecker](https://bugs.launchpad.net/calibre/+bug/1517928)

This commit is contained in:
Kovid Goyal 2015-11-20 10:05:47 +05:30
parent 45e732332d
commit e150b9f159

View File

@ -243,13 +243,13 @@ class Dictionaries(object):
def add_user_words(self, words, langcode):
for d in self.dictionaries.itervalues():
if getattr(d.primary_locale, 'langcode', None) == langcode:
if d and getattr(d.primary_locale, 'langcode', None) == langcode:
for word in words:
d.obj.add(word)
def remove_user_words(self, words, langcode):
for d in self.dictionaries.itervalues():
if d.primary_locale.langcode == langcode:
if d and d.primary_locale.langcode == langcode:
for word in words:
d.obj.remove(word)