summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-03-05 12:22:02 +0100
committerhut <hut@lavabit.com>2012-03-05 12:22:02 +0100
commit9dde8e361b0b71d1aa6bb5086313b90f5fc25dd5 (patch)
tree80cb65a50ac59522970810fbc5516b4bc43cb8b7
parente1155824b39d584beb8c178ceca8999eb7783daf (diff)
downloadranger-9dde8e361b0b71d1aa6bb5086313b90f5fc25dd5.tar.gz
Fix crash when opening files with feh or sxiv with "ranger <image>"
-rw-r--r--ranger/defaults/apps.py5
1 files 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