Fix crash when there's no completion.
This commit is contained in:
parent
70243d6e2f
commit
4577659342
@ -138,7 +138,7 @@ class Completer(QObject):
|
|||||||
cursor_part: The part the cursor is in.
|
cursor_part: The part the cursor is in.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
A completion model.
|
A completion model or None.
|
||||||
"""
|
"""
|
||||||
if completion == usertypes.Completion.option:
|
if completion == usertypes.Completion.option:
|
||||||
section = parts[cursor_part - 1]
|
section = parts[cursor_part - 1]
|
||||||
@ -153,6 +153,10 @@ class Completer(QObject):
|
|||||||
model = None
|
model = None
|
||||||
else:
|
else:
|
||||||
model = instances.get(completion)
|
model = instances.get(completion)
|
||||||
|
|
||||||
|
if model is None:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
return sortfilter.CompletionFilterModel(source=model, parent=self)
|
return sortfilter.CompletionFilterModel(source=model, parent=self)
|
||||||
|
|
||||||
def _filter_cmdline_parts(self, parts, cursor_part):
|
def _filter_cmdline_parts(self, parts, cursor_part):
|
||||||
|
Loading…
Reference in New Issue
Block a user