summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-01-04 01:54:09 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:36 +0100
commitd90c1978def803390203f0fada3621de8abba0e5 (patch)
treed744ea0047d47b8ed2c1cd68107dedfdee885e76
parentfbec16f1a208881ea49923287aae27978d79681e (diff)
downloadbiboumi-d90c1978def803390203f0fada3621de8abba0e5.tar.gz
biboumi-d90c1978def803390203f0fada3621de8abba0e5.tar.bz2
biboumi-d90c1978def803390203f0fada3621de8abba0e5.tar.xz
biboumi-d90c1978def803390203f0fada3621de8abba0e5.zip
Fix a bug when receiving a topic change
The number of arguments is not always the same
-rw-r--r--src/irc/irc_client.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 644cfd1..1e8e326 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -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)
+ return;
+ 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);
}