summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-01-04 01:02:00 +0100
committerhut <hut@lavabit.com>2011-01-04 01:02:00 +0100
commitee7b001d56612d1169d9af7ccd60829fe4611cc9 (patch)
treeb9b6e522a4eee567fe65088e60585297e0ff1f23 /ranger
parent8a1f66bb48a3d35e8f7a73685f963126f0c71744 (diff)
downloadranger-ee7b001d56612d1169d9af7ccd60829fe4611cc9.tar.gz
widgets.pager: Fixed crash when scope.sh fails
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/widgets/pager.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index 64444064..d851de3f 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -167,14 +167,17 @@ class Pager(Widget):
 		if self.source and self.source_is_stream:
 			self.source.close()
 
+		self.max_width = 0
 		if isinstance(source, str):
 			self.source_is_stream = False
 			self.lines = source.splitlines()
-			self.max_width = max(len(line) for line in self.lines)
+			if self.lines:
+				self.max_width = max(len(line) for line in self.lines)
 		elif hasattr(source, '__getitem__'):
 			self.source_is_stream = False
 			self.lines = source
-			self.max_width = max(len(line) for line in source)
+			if self.lines:
+				self.max_width = max(len(line) for line in source)
 		elif hasattr(source, 'readline'):
 			self.source_is_stream = True
 			self.lines = []