diff options
author | nfnty <git@nfnty.se> | 2017-02-25 11:05:20 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-02-25 11:07:56 +0100 |
commit | bb9433e98874fe93a1b3f34848c74050fe9e58af (patch) | |
tree | 165a3d70e1386b4a6b04e95abbdd199648598ff2 /ranger | |
parent | 85c5bff9a565d11f93ee7801ac13a7d8c832158e (diff) | |
download | ranger-bb9433e98874fe93a1b3f34848c74050fe9e58af.tar.gz |
gui.widgets.console.Console: Don't crash when parsing corrupt history file
Fixes #817
Diffstat (limited to 'ranger')
-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) |