From 4577659342c08baba635e0a41399ad2d23693f52 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 24 Aug 2015 00:08:55 +0200 Subject: [PATCH] Fix crash when there's no completion. --- qutebrowser/completion/completer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index befd2c01d..7dc66816b 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -138,7 +138,7 @@ class Completer(QObject): cursor_part: The part the cursor is in. Return: - A completion model. + A completion model or None. """ if completion == usertypes.Completion.option: section = parts[cursor_part - 1] @@ -153,7 +153,11 @@ class Completer(QObject): model = None else: model = instances.get(completion) - return sortfilter.CompletionFilterModel(source=model, parent=self) + + if model is None: + return None + else: + return sortfilter.CompletionFilterModel(source=model, parent=self) def _filter_cmdline_parts(self, parts, cursor_part): """Filter a list of commandline parts to exclude flags.