Right clicking in macro panel causes crash if no spellcheck language is selected
Summary
If no spellcheck language has been previously selected, right clicking the editable text box in the macro panel will cause the application to crash.
Steps to reproduce
- Make sure no spellcheck language has previously been selected.
- Open macro panel.
- Right click the editable text box within the panel.
What is the current bug behavior?
Right click menu doesn't appear and the application crashes.
What is the expected correct behavior?
Right click menu should display with the expected options for an editable field such as copy, paste, etc. If no spellcheck language has previously been selected, the spellcheck sub-menu should reflect that. Once a language has been chosen it should be impossible to revert to no language without closing the application.
What system and libraries are you using?
Windows 10 and Python 3.8.3. Python packages were installed using requirements.txt file (specific versions listed below):
- matplotlib 3.3.0
- numpy 1.19.0
- pip 19.2.3
- pyenchant 3.1.1
- PyQt5 5.15.0
Relevant logs and/or screenshots
Traceback (most recent call last):
File "C:\pyspread\pyspread\lib\spelltextedit.py", line 294, in contextMenuEvent
popup_menu = self.createSpellcheckContextMenu(event.pos())
File "C:\pyspread\pyspread\lib\spelltextedit.py", line 317, in createSpellcheckContextMenu
menu.addMenu(self.createLanguagesMenu(menu))
File "C:\pyspread\pyspread\lib\spelltextedit.py", line 357, in createLanguagesMenu
curr_lang = self.highlighter.dict().tag
AttributeError: 'NoneType' object has no attribute 'tag'
Possible fixes
pyspread/lib/spelltextedit.py:357 is the cause of the problem. Fortunately the fix is very simple and I've created a merge request for it.