olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.71k stars 226 forks source link

Crash on spellcheck context menu #1224

Closed MatHuf closed 7 months ago

MatHuf commented 9 months ago

When right clicking on a misspelled word to open the context menu Manuskript crashes. This appears to be when a word has no suggestions (very misspelled or not in dictionary) as it works just fine for misspelled words that have suggestions. This is reproducible for any word that has no suggestions.

OS: Manjaro Manuskript Version: 0.15.0 Software Versions in Use: Python 3.11.5 PyQt 5.15.9 Qt 5.15.8 Dictionary: pyspellchecker

2023-09-19 17:38:23,941 - manuskript.logging - CRITICAL - An unhandled exception has occurred! Traceback (most recent call last): File "/usr/share/manuskript/manuskript/ui/views/textEditView.py", line 496, in contextMenuEvent popup_menu = self.createStandardContextMenu() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/manuskript/manuskript/ui/views/textEditView.py", line 590, in createStandardContextMenu suggestions = self._dict.findSuggestions(text, cursor.selectionStart(), cursor.selectionEnd()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/manuskript/manuskript/functions/spellchecker.py", line 220, in findSuggestions match.replacements = self.getSuggestions(word) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/manuskript/manuskript/functions/spellchecker.py", line 366, in getSuggestions if word in candidates: ^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable