Commit d90c1978 authored by louiz’'s avatar louiz’

Fix a bug when receiving a topic change

The number of arguments is not always the same
parent fbec16f1
......@@ -321,9 +321,11 @@ void IrcClient::send_motd(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)
const std::string chan_name = utils::tolower(message.arguments[message.arguments.size() - 2]);
IrcChannel* channel = this->get_channel(chan_name);
channel->topic = message.arguments[2];
channel->topic = message.arguments[message.arguments.size() - 1];
if (channel->joined)
this->bridge->send_topic(this->hostname, chan_name, channel->topic);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment