stop console from crashing on input before it is started
This commit is contained in:
parent
7a3bdf93e9
commit
c8afce2a3a
1 changed files with 4 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue