diff options
author | toonn <toonn@toonn.io> | 2021-01-05 20:03:15 +0100 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2021-01-05 20:03:15 +0100 |
commit | 3706bf7d6db7da308fb88459b9803ce85751a87b (patch) | |
tree | 7169e18fb30e50771f07a87ebe12ad23e3a4bd8a | |
parent | 1ea2f68800ccdcf3f0d26b608201f8a7807bdf37 (diff) | |
parent | f1c5ff1e9086f7fbe6c610c53b15cacddcef036b (diff) | |
download | ranger-3706bf7d6db7da308fb88459b9803ce85751a87b.tar.gz |
Merge branch 'fix-files-none'
-rw-r--r-- | ranger/core/tab.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py index 64edf120..3a0fb943 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -57,19 +57,22 @@ class Tab(FileManagerAware, SettingsAware): # pylint: disable=too-many-instance thisfile = property(_get_thisfile, _set_thisfile) def _get_pointer(self): - if ( - self.thisdir is not None - and self.thisdir.files[self._pointer] != self._pointed_obj - ): - try: - self._pointer = self.thisdir.files.index(self._pointed_obj) - except ValueError: - self._pointed_obj = self.thisdir.files[self._pointer] + try: + if self.thisdir.files[self._pointer] != self._pointed_obj: + try: + self._pointer = self.thisdir.files.index(self._pointed_obj) + except ValueError: + self._set_pointer(self._pointer) + except (TypeError, IndexError): + pass return self._pointer def _set_pointer(self, value): self._pointer = value - self._pointed_obj = self.thisdir.files[self._pointer] + try: + self._pointed_obj = self.thisdir.files[self._pointer] + except (TypeError, IndexError): + pass pointer = property(_get_pointer, _set_pointer) |