Fix crash after #unsubscribe

The #unsubscribe command was setting the person's subscription to None
which obviously can't be compiled to a regex.  This caused a crash on
the first now/next update after someone did #unsubscribe.  Fix this
simply by skipping any subscription where the regex is set to None.

Change-Id: I11d42bcb1a0e3bc2e4105d6c2afa39f3a37af278
This commit is contained in:
Adam Spiers 2019-05-03 09:42:29 -06:00
parent b14ec32f05
commit 0145545e78
1 changed files with 3 additions and 0 deletions

View File

@ -394,6 +394,9 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot):
trackloc = "%s (%s)" % (track, location)
for nick, regexp in self.data.get_subscriptions().items():
if regexp is None:
# Person did #unsubscribe, so skip
continue
event_text = " ".join([track, adverb, params])
if re.search(regexp, event_text, re.IGNORECASE):
message = "%s in %s: %s" % (adverb, trackloc, params)