From 9dde8e361b0b71d1aa6bb5086313b90f5fc25dd5 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 5 Mar 2012 12:22:02 +0100 Subject: Fix crash when opening files with feh or sxiv with "ranger " --- ranger/defaults/apps.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ranger/defaults/apps.py b/ranger/defaults/apps.py index fbcc83c0..1619eb1e 100644 --- a/ranger/defaults/apps.py +++ b/ranger/defaults/apps.py @@ -226,7 +226,8 @@ class CustomApplications(Applications): @depends_on('feh', 'X') def app_feh(self, c): c.flags += 'd' - if c.mode is 0 and len(c.files) is 1: # view all files in the cwd + if c.mode is 0 and len(c.files) is 1 and self.fm.env.cwd: + # view all files in the cwd images = [f.basename for f in self.fm.env.cwd.files if f.image] return 'feh', '--start-at', c.file.basename, images return 'feh', c @@ -234,7 +235,7 @@ class CustomApplications(Applications): @depends_on('sxiv', 'X') def app_sxiv(self, c): c.flags = 'd' + c.flags - if len(c.files) is 1: + if len(c.files) is 1 and self.fm.env.cwd: images = [f.basename for f in self.fm.env.cwd.files if f.image] try: position = images.index(c.file.basename) + 1 -- cgit 1.4.1-2-gfad0