From 9bfec720f5e37c1f1cb8583a3598597aafcff8c0 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 13 Jul 2013 12:01:53 +0200 Subject: [PATCH] Fix traceback if bot is kicked immediately after joining a channel. --- src/irclib.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index dfb73022b..fcecbf6e5 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -518,8 +518,14 @@ class IrcState(IrcCommandDispatcher): def do367(self, irc, msg): # Example: # :server 367 user #chan some!random@user evil!channel@op 1356276459 - state = self.channels[msg.args[1]] - state.bans.add(msg.args[2]) + try: + state = self.channels[msg.args[1]] + except KeyError: + # We have been kicked of the channel before the server replied to + # the MODE +b command. + pass + else: + state.bans.add(msg.args[2]) def doMode(self, irc, msg): channel = msg.args[0]