Fix a bug when receiving a topic change

The number of arguments is not always the same
This commit is contained in:
Florent Le Coz
2014-01-04 01:59:36 +01:00
parent fbec16f1a2
commit d90c1978de
+4 -2
View File
@@ -321,9 +321,11 @@ void IrcClient::send_motd(const IrcMessage& message)
void IrcClient::on_topic_received(const IrcMessage& message) void IrcClient::on_topic_received(const IrcMessage& message)
{ {
const std::string chan_name = utils::tolower(message.arguments[1]); if (message.arguments.size() < 2)
return;
const std::string chan_name = utils::tolower(message.arguments[message.arguments.size() - 2]);
IrcChannel* channel = this->get_channel(chan_name); IrcChannel* channel = this->get_channel(chan_name);
channel->topic = message.arguments[2]; channel->topic = message.arguments[message.arguments.size() - 1];
if (channel->joined) if (channel->joined)
this->bridge->send_topic(this->hostname, chan_name, channel->topic); this->bridge->send_topic(this->hostname, chan_name, channel->topic);
} }