File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -363,7 +363,7 @@ def isMisspelled(self, word):
363
363
364
364
def getSuggestions (self , word ):
365
365
candidates = self ._dict .candidates (word )
366
- if word in candidates :
366
+ if candidates and word in candidates :
367
367
candidates .remove (word )
368
368
return candidates
369
369
Original file line number Diff line number Diff line change @@ -620,10 +620,11 @@ def createStandardContextMenu(self):
620
620
621
621
selectedWord = cursor .selectedText ()
622
622
623
- for word in match .replacements :
624
- action = self .SpellAction (word , spell_menu )
625
- action .correct .connect (self .correctWord )
626
- spell_menu .addAction (action )
623
+ if match .replacements :
624
+ for word in match .replacements :
625
+ action = self .SpellAction (word , spell_menu )
626
+ action .correct .connect (self .correctWord )
627
+ spell_menu .addAction (action )
627
628
628
629
# Adds: add to dictionary
629
630
addAction = QAction (self .tr ("&Add to dictionary" ), popup_menu )
@@ -635,7 +636,7 @@ def createStandardContextMenu(self):
635
636
636
637
# Only add the spelling suggests to the menu if there are
637
638
# suggestions.
638
- if len (match .replacements ) > 0 :
639
+ if match . replacements and len (match .replacements ) > 0 :
639
640
# Adds: suggestions
640
641
popup_menu .insertMenu (popup_menu .actions ()[0 ], spell_menu )
641
642
else :
You can’t perform that action at this time.
0 commit comments