From e150b9f1591faa05dc5a7899575468d3eaeb705e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Nov 2015 10:05:47 +0530 Subject: [PATCH] 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) --- src/calibre/spell/dictionary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/spell/dictionary.py b/src/calibre/spell/dictionary.py index 2b9eaa4523..138dce08be 100644 --- a/src/calibre/spell/dictionary.py +++ b/src/calibre/spell/dictionary.py @@ -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)