summaryrefslogtreecommitdiff
path: root/modules/commands/os_sxline.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-07 15:41:49 -0500
committerAdam <Adam@anope.org>2012-11-07 15:41:49 -0500
commit8b78b6bb104e8c1088d066f153967678b50a15a8 (patch)
treeaccc740a620890bdbbd519d1e4b354af4577492f /modules/commands/os_sxline.cpp
parent52fa66820c5166f30da65db14986483cdb6cd916 (diff)
Fix crash on suspend etc if kicking a user causes the service bot to part when the service bot is next in the userlist (as we have an iterator to it)
Diffstat (limited to 'modules/commands/os_sxline.cpp')
-rw-r--r--modules/commands/os_sxline.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp
index ea7f7840d..9261bcddd 100644
--- a/modules/commands/os_sxline.cpp
+++ b/modules/commands/os_sxline.cpp
@@ -594,15 +594,19 @@ class CommandOSSQLine : public CommandOSSXLineBase
if (!Anope::Match(c->name, mask, false, true))
continue;
- for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; )
+
+ std::vector<User *> users;
+ for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it)
{
UserContainer *uc = *it;
- ++it;
+ User *user = uc->user;
- if (uc->user->HasMode(UMODE_OPER) || uc->user->server == Me)
- continue;
- c->Kick(NULL, uc->user, "%s", reason.c_str());
+ if (!user->HasMode(UMODE_OPER) && user->server != Me)
+ users.push_back(user);
}
+
+ for (unsigned i = 0; i < users.size(); ++i)
+ c->Kick(NULL, users[i], "%s", reason.c_str());
}
}
else