Change to an early continue for a NULL IrcUser
authorMatt Schatz <genius3000@g3k.solutions>
Sun, 9 Sep 2018 18:27:37 +0000 (12:27 -0600)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 9 Sep 2018 21:28:28 +0000 (23:28 +0200)
Commit e9096505f07fc0c08a7c36f3680c1fde975d4f80 changed the behaviour
in joinIrcUsers() from skipping a NULL IrcUser or an already tracked
IrcUser to updating the usermodes of said IrcUser. The call to
addUserMode() will call isKnownUser() which will log a warning
of 'received IrcUser Nullpointer' and return false. This is safe
from crashing, but shouldn't be allowed to happen.

src/common/ircchannel.cpp

index 43e1dee..0684c66 100644 (file)
@@ -180,7 +180,9 @@ void IrcChannel::joinIrcUsers(const QList<IrcUser *> &users, const QStringList &
     IrcUser *ircuser;
     for (int i = 0; i < users.count(); i++) {
         ircuser = users[i];
-        if (!ircuser || _userModes.contains(ircuser)) {
+        if (!ircuser)
+            continue;
+        if (_userModes.contains(ircuser)) {
             if (sortedModes[i].count() > 1) {
                 // Multiple modes received, do it one at a time
                 // TODO Better way of syncing this without breaking protocol?