summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/u_listmode.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/u_listmode.h b/include/u_listmode.h
index bc6a9fa20..b733d7536 100644
--- a/include/u_listmode.h
+++ b/include/u_listmode.h
@@ -107,8 +107,14 @@ class ListModeBase : public ModeHandler
char moderemove[MAXBUF];
userrec* n = new userrec(ServerInstance);
n->SetFd(FD_MAGIC_NUMBER);
+ modelist copy;
+ /* Make a copy of it, because we cant change the list whilst iterating over it */
for(modelist::iterator it = el->begin(); it != el->end(); it++)
{
+ copy.push_back(*it);
+ }
+ for(modelist::iterator it = copy.begin(); it != copy.end(); it++)
+ {
ServerInstance->Log(DEBUG,"Remove item %s",it->mask.c_str());
sprintf(moderemove,"-%c",this->GetModeChar());
const char* parameters[] = { channel->name, moderemove, it->mask.c_str() };