Do not crash on privmsg with no content

There is a corner case (/dcc chat) where a privmsg can have no content.
Ignore such corner cases instead of crashing.

Change-Id: Ia07c76c4a2342bb4e7bc9c37a4944d4b9f18efd8
This commit is contained in:
Thierry Carrez 2020-06-02 15:38:07 +02:00
parent 4f32e1fbf7
commit 1db00eafb8
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot):
nick = e.source.split('!')[0] nick = e.source.split('!')[0]
msg = e.arguments[0][1:] msg = e.arguments[0][1:]
words = msg.split() words = msg.split()
if len(words) < 1:
self.log.debug("Ignoring privmsg with no content")
return
cmd = words[0].lower() cmd = words[0].lower()
words.pop(0) words.pop(0)