m_channames Fix iteration in ValidateChans()

Spotted by @Adam-
This commit is contained in:
attilamolnar 2013-05-18 21:02:09 +02:00
parent 740539d620
commit ecf7690813

View File

@ -89,9 +89,17 @@ class ModuleChannelNames : public Module
ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient);
}
const UserMembList* users = c->GetUsers();
for(UserMembCIter j = users->begin(); j != users->end(); ++j)
for(UserMembCIter j = users->begin(); j != users->end(); )
{
if (IS_LOCAL(j->first))
c->KickUser(ServerInstance->FakeClient, j->first, "Channel name no longer valid");
{
// KickUser invalidates the iterator
UserMembCIter it = j++;
c->KickUser(ServerInstance->FakeClient, it->first, "Channel name no longer valid");
}
else
++j;
}
}
badchan = false;
}