diff options
author | Matt Schatz <genius3000@g3k.solutions> | 2021-02-16 20:12:16 -0700 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-02-19 01:37:08 +0000 |
commit | c67911bfcc44b8fe010f3a35e966746c30656d55 (patch) | |
tree | f64d6273a5bb7fb4c332ac9ff86b5fc7d80b54af | |
parent | 4d271e021042f0b2708abaff5ff3cfb1504a5cc0 (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.
-rw-r--r-- | src/bots.cpp | 4 |
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); } |