about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-01 17:12:16 +0100
committerhut <hut@lavabit.com>2010-01-01 17:12:16 +0100
commit501f501418d8894af2783a2681e5669c3f40586d (patch)
tree252f9f8e87f6f9b484930c89d9e79771699d590b /ranger
parent67bb838cc2b0cfc8acb6087d694692718e7895b7 (diff)
downloadranger-501f501418d8894af2783a2681e5669c3f40586d.tar.gz
bookmarks: catch some special conditions
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/bookmarks.py4
-rw-r--r--ranger/gui/widgets/browserview.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index 2d58c1d8..6c2ebd63 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -143,6 +143,10 @@ class Bookmarks(object):
 	def _load_dict(self):
 		import os
 		dct = {}
+		if not os.path.exists(self.path):
+			f = open(self.path, 'w')
+			f.close()
+
 		if os.access(self.path, os.R_OK):
 			f = open(self.path, 'r')
 			for line in f:
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py
index 7238d95f..3fae7715 100644
--- a/ranger/gui/widgets/browserview.py
+++ b/ranger/gui/widgets/browserview.py
@@ -61,7 +61,10 @@ class BrowserView(Widget, DisplayableContainer):
 		def generator():
 			return zip(range(self.hei), sorted_bookmarks)
 
-		maxlen = max(len(item[1].path) for i, item in generator())
+		try:
+			maxlen = max(len(item[1].path) for i, item in generator())
+		except ValueError:
+			return
 		maxlen = min(maxlen + 5, self.wid)
 
 		for line, items in generator():