Fixed issue introduced by change in the lexer that caused mitmproxy to

crash when pressing `:`.
This commit is contained in:
Henrique 2019-11-13 10:17:07 -05:00
parent 875adb2ba8
commit af7088d7f3

View File

@ -89,6 +89,12 @@ class CommandBuffer:
""" """
parts, remhelp = self.parse_quoted(self.text) parts, remhelp = self.parse_quoted(self.text)
ret = [] ret = []
if parts == []:
# Means we just received the leader, so we need to give a blank
# text to the widget to render or it crashes
ret.append(("text", ""))
ret.append(("text", " "))
else:
for p in parts: for p in parts:
if p.valid: if p.valid:
if p.type == mitmproxy.types.Cmd: if p.type == mitmproxy.types.Cmd:
@ -104,6 +110,7 @@ class CommandBuffer:
ret.append(("text", " ")) ret.append(("text", " "))
for v in remhelp: for v in remhelp:
ret.append(("commander_hint", "%s " % v)) ret.append(("commander_hint", "%s " % v))
return ret return ret
def flatten(self, txt): def flatten(self, txt):