diff options
-rw-r--r-- | src/modules/m_channames.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index e78171c4a..b5f5853e7 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -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; } |