summary refs log tree commit diff stats
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
parent8a1f66bb48a3d35e8f7a73685f963126f0c71744 (diff)
downloadranger-ee7b001d56612d1169d9af7ccd60829fe4611cc9.tar.gz
widgets.pager: Fixed crash when scope.sh fails
-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 = []
48'>148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209