summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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 = []
ef='#n111'>111 112 113 114 115 116 117 118 119 120 121 122 123 124