From 677f7fdd6fe4d119aa36a468d856d8957601f456 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 10 Oct 2013 14:10:06 +0000 Subject: [PATCH] irclib: Prevent crash if 324 or 329 is not received after any other post-join messages. --- src/irclib.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/irclib.py b/src/irclib.py index eed0fbbff..d640ffc36 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -532,7 +532,11 @@ class IrcState(IrcCommandDispatcher): def do324(self, irc, msg): channel = msg.args[1] - chan = self.channels[channel] + try: + chan = self.channels[channel] + except KeyError: + chan = ChannelState() + self.channels[channel] = chan for (mode, value) in ircutils.separateModes(msg.args[2:]): modeChar = mode[1] if mode[0] == '+' and mode[1] not in 'ovh': @@ -543,7 +547,11 @@ class IrcState(IrcCommandDispatcher): def do329(self, irc, msg): # This is the last part of an empty mode. channel = msg.args[1] - chan = self.channels[channel] + try: + chan = self.channels[channel] + except KeyError: + chan = ChannelState() + self.channels[channel] = chan chan.created = int(msg.args[2]) def doPart(self, irc, msg):