diff options
-rw-r--r-- | ranger/gui/widgets/console.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index cc595230..2d905f62 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -47,8 +47,12 @@ class Console(Widget): # pylint: disable=too-many-instance-attributes,too-many- except OSError as ex: self.fm.notify('Failed to read history file', bad=True, exception=ex) else: - for line in fobj: - self.history.add(line[:-1]) + try: + for line in fobj: + self.history.add(line[:-1]) + except UnicodeDecodeError as ex: + self.fm.notify('Failed to parse corrupt history file', + bad=True, exception=ex) fobj.close() self.history_backup = History(self.history) |