aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-02-08 23:42:56 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-02-08 23:42:56 +1300
commit46c5982d3da0355f458ceea2077230fbed9c289b (patch)
tree583f1f45c663da8cac99e57cdfe5f507e837e07b
parent205d2ad577f0d00ed7d3ff36b8ba24bcdf312585 (diff)
downloadmitmproxy-46c5982d3da0355f458ceea2077230fbed9c289b.tar.gz
mitmproxy-46c5982d3da0355f458ceea2077230fbed9c289b.tar.bz2
mitmproxy-46c5982d3da0355f458ceea2077230fbed9c289b.zip
Fix a crash and some sizing issues in KVEditor.
Mostly arising when editing an empty header set.
-rw-r--r--libmproxy/console/kveditor.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/libmproxy/console/kveditor.py b/libmproxy/console/kveditor.py
index 632a6992..e74895bb 100644
--- a/libmproxy/console/kveditor.py
+++ b/libmproxy/console/kveditor.py
@@ -90,7 +90,9 @@ class KVItem(common.WWrap):
class KVWalker(urwid.ListWalker):
def __init__(self, lst):
self.lst = lst
- self.maxk = max(len(v[0]) for v in lst)
+ self.maxk = max(len(v[0]) for v in lst) if lst else 20
+ if self.maxk < 20:
+ self.maxk = 20
self.focus = 0
self.focus_col = 0
self.editing = False