From 13e58248f8b0c34d8e0b54429170cf9e05072d86 Mon Sep 17 00:00:00 2001 From: nfnty Date: Thu, 2 Feb 2017 01:09:51 +0100 Subject: gui.widgets.console.Console: Fix closing when line empty --- ranger/gui/widgets/console.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index c0655e5c..86a80177 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -441,12 +441,13 @@ class Console(Widget): # pylint: disable=too-many-instance-attributes,too-many- def _get_cmd(self, quiet=False): try: command_class = self.get_cmd_class() + except IndexError: + return None except KeyError: if not quiet: - error = "Command not found: `%s'" % self.line.split()[0] - self.fm.notify(error, bad=True) - else: - return command_class(self.line) + self.fm.notify("Command not found: `%s'" % self.line.split()[0], bad=True) + return None + return command_class(self.line) def get_cmd_class(self): return self.fm.commands.get_command(self.line.split()[0]) -- cgit 1.4.1-2-gfad0