Make sure IrcEventTopic always has two params
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 5 Oct 2010 16:17:47 +0000 (18:17 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 13 Oct 2010 23:06:32 +0000 (01:06 +0200)
In case of an empty topic, adding a null string in the event saves us from
specialcasing this in a few places.

src/core/ircparser.cpp

index 75ac2c9..34e693d 100644 (file)
@@ -242,10 +242,10 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e) {
     break;
 
   case EventManager::IrcEventTopic:
-    if(params.count() >= 2) {
+    if(params.count() >= 1) {
       QString channel = net->serverDecode(params.at(0));
       decParams << channel;
-      decParams << net->channelDecode(channel, decrypt(net, channel, params.at(1), true));
+      decParams << (params.count() >= 2? net->channelDecode(channel, decrypt(net, channel, params.at(1), true)) : QString());
     }
     break;