From ebb6bc580bf58f011121a379e2dd651d849b6fce Mon Sep 17 00:00:00 2001 From: Stuart Travers Date: Wed, 21 Sep 2016 07:48:13 +1000 Subject: [PATCH] Fix crash on /login if args != 2 --- pokemongo_bot/event_handlers/telegram_handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pokemongo_bot/event_handlers/telegram_handler.py b/pokemongo_bot/event_handlers/telegram_handler.py index 79f66939f4..2f694f5ddc 100644 --- a/pokemongo_bot/event_handlers/telegram_handler.py +++ b/pokemongo_bot/event_handlers/telegram_handler.py @@ -92,7 +92,11 @@ def deauthenticate(self, update): return def authenticate(self, update): - (command, password) = update.message.text.split(' ') + args = update.message.text.split(' ') + if len(args) != 2: + self.chat_handler.sendMessage(chat_id=update.message.chat_id, parse_mode='Markdown', text="Invalid password") + return + password = args[1] if password != self.config.get('password', None): self.chat_handler.sendMessage(chat_id=update.message.chat_id, parse_mode='Markdown', text="Invalid password") else: