Don't crash on :completion-item-del with no item.

If :completion-item-del was invoked with no item selected (e.g. directly after
pressing 'o'), there was a crash because the currentIndex was invalid.

/cc @antoyo (but I believe one of my changes on top of yours caused this)
This commit is contained in:
Florian Bruhin 2015-08-05 06:55:39 +02:00
parent 15e854237e
commit 5a25f0b98b

View File

@ -488,6 +488,8 @@ class Completer(QObject):
"""Delete the current completion item."""
completion = objreg.get('completion', scope='window',
window=self._win_id)
if not completion.currentIndex().isValid():
raise cmdexc.CommandError("No item selected!")
try:
self.model().srcmodel.delete_cur_item(completion)
except NotImplementedError: