diff options
author | hut <hut@lavabit.com> | 2010-03-27 04:06:00 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-03-27 04:06:00 +0100 |
commit | 7ae1689217f9e7dee479941c4f5d9f15c99ad1b6 (patch) | |
tree | f26830c8dc581a2ab8fbf8c822aef161360e5c77 | |
parent | 6099d9a30611e406afd5a257acd4b9bcb6954857 (diff) | |
download | ranger-7ae1689217f9e7dee479941c4f5d9f15c99ad1b6.tar.gz |
fixed bug in defaults.apps
Sometimes, maybe when a directory is GCed while youre inside, it shows a "NoneType is not iterable" error when trying to open images
-rw-r--r-- | ranger/defaults/apps.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ranger/defaults/apps.py b/ranger/defaults/apps.py index 347b9ce2..5be33828 100644 --- a/ranger/defaults/apps.py +++ b/ranger/defaults/apps.py @@ -151,15 +151,18 @@ class CustomApplications(Applications): if len(c.files) > 1: return tup('feh', *c) - from collections import deque + try: + from collections import deque - directory = self.fm.env.get_directory(c.file.dirname) - images = [f.path for f in directory.files if f.image] - position = images.index(c.file.path) - deq = deque(images) - deq.rotate(-position) + directory = self.fm.env.get_directory(c.file.dirname) + images = [f.path for f in directory.files if f.image] + position = images.index(c.file.path) + deq = deque(images) + deq.rotate(-position) - return tup('feh', *deq) + return tup('feh', *deq) + except: + return tup('feh', *c) @depends_on("gimp") def app_gimp(self, c): |