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
This commit is contained in:
Thierry Carrez 2021-04-16 11:23:32 +02:00
parent b728b153e4
commit 5a791cde41
1 changed files with 6 additions and 0 deletions

View File

@ -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':