From c8afce2a3a697a74dd58c95bc752bb452286e73a Mon Sep 17 00:00:00 2001 From: Jimmy Kiselak Date: Mon, 23 Nov 2015 15:11:34 -0500 Subject: [PATCH] stop console from crashing on input before it is started --- lbrynet/lbrynet_console/ConsoleControl.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lbrynet/lbrynet_console/ConsoleControl.py b/lbrynet/lbrynet_console/ConsoleControl.py index a69b73350..4d49fd6d4 100644 --- a/lbrynet/lbrynet_console/ConsoleControl.py +++ b/lbrynet/lbrynet_console/ConsoleControl.py @@ -12,6 +12,8 @@ class ConsoleControl(basic.LineReceiver): def __init__(self): self.connected = False self.buffer = [] + self.command_handlers = {} + self.current_handler = None def start(self, command_handlers): self.command_handlers = {h.command: h for h in command_handlers} @@ -83,6 +85,8 @@ class ConsoleControl(basic.LineReceiver): self.show_prompt() def lineReceived(self, line): + if not self.command_handlers: + return if self.current_handler is None: words = line.split() if len(words) == 0: