summaryrefslogtreecommitdiff
path: root/src/modules/m_channames.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_channames.cpp')
-rw-r--r--src/modules/m_channames.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp
index 9b43649a8..52f781ae1 100644
--- a/src/modules/m_channames.cpp
+++ b/src/modules/m_channames.cpp
@@ -87,9 +87,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;
}