summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-13 22:55:14 +0100
committerhut <hut@lavabit.com>2010-01-13 22:55:14 +0100
commit1f9a86d1515416a03721be261ae8fc937f129e9d (patch)
tree623b409b886f943cd9756b769289d4efe575a786
parentd8ea8d5fff1c0973a1c361672565b915d81bf774 (diff)
downloadranger-1f9a86d1515416a03721be261ae8fc937f129e9d.tar.gz
commandlist: no error when trying to alias to unexisting key
-rw-r--r--ranger/container/commandlist.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/ranger/container/commandlist.py b/ranger/container/commandlist.py
index e66871ea..c40d0a5b 100644
--- a/ranger/container/commandlist.py
+++ b/ranger/container/commandlist.py
@@ -132,11 +132,14 @@ class CommandList(object):
 		existing = self._str_to_tuple(existing)
 		new = tuple(map(self._str_to_tuple, new))
 
-		cmd = self.paths[existing]
-
-		for key in new:
-			self.paths[key] = cmd
-			cmd.keys |= set([key])
+		try:
+			cmd = self.paths[existing]
+		except KeyError:
+			self.unbind(*new)
+		else:
+			for key in new:
+				self.paths[key] = cmd
+				cmd.keys |= set([key])
 
 	def unbind(self, *keys):
 		i = len(self.commandlist)