From 5a791cde41b4f32f00c5fa2bf6203ab2dde13a2e Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Fri, 16 Apr 2021 11:23:32 +0200 Subject: [PATCH] Fix airbag deployment on empty messages PTGbot airbag deploys on empty messages (messages containing only spaces, or /me actions). Fix this crash to avoid airbag deployment. Change-Id: I4def945894419536fd3d340e3850007210adf17f --- ptgbot/bot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ptgbot/bot.py b/ptgbot/bot.py index 51584a0..a516ff6 100644 --- a/ptgbot/bot.py +++ b/ptgbot/bot.py @@ -133,6 +133,12 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot): def handle_public_command(self, chan, nick, args): words = args.split() + + # Some messages are empty or only contain spaces. + # Do nothing in that case. + if not words: + return + cmd = words[0].lower() if len(cmd) > 1 and cmd[1:] == 'help':