summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Schatz <genius3000@g3k.solutions>2021-02-16 20:12:16 -0700
committerSadie Powell <sadie@witchery.services>2021-02-19 01:37:08 +0000
commitc67911bfcc44b8fe010f3a35e966746c30656d55 (patch)
treef64d6273a5bb7fb4c332ac9ff86b5fc7d80b54af /src
parent4d271e021042f0b2708abaff5ff3cfb1504a5cc0 (diff)
bots: Fix dtor channel iterator being invalidated.
The call to UnAssign() erases the channel from the set which invalidates the iterator in this loop. Handle this in the same manner as the NickCore dtor.
Diffstat (limited to 'src')
-rw-r--r--src/bots.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index 2f6c916a7..94b688f0d 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -62,9 +62,9 @@ BotInfo::~BotInfo()
IRCD->SendSQLineDel(&x);
}
- for (std::set<ChannelInfo *>::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end; ++it)
+ for (std::set<ChannelInfo *>::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end;)
{
- ChannelInfo *ci = *it;
+ ChannelInfo *ci = *it++;
this->UnAssign(NULL, ci);
}