diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-01-16 10:58:28 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-01-16 10:58:28 +0100 |
commit | 30610582c750b4c62f2ae74d1396c1e5d1a5d7bc (patch) | |
tree | 388f593affdae56b321f2a4984c8237bf2568df9 | |
parent | 66221de4b6cca64692c84eabfe0b81cabdbd00bc (diff) |
Gracefully handle multiple Channel::CheckDestroy() calls on the same object
Don't add the channel to the cull list more than once
-rw-r--r-- | src/channels.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index fdf0f76e1..02a6ae30b 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -86,14 +86,13 @@ void Channel::CheckDestroy() if (res == MOD_RES_DENY) return; + // If the channel isn't in chanlist then it is already in the cull list, don't add it again chan_hash::iterator iter = ServerInstance->chanlist.find(this->name); - /* kill the record */ - if (iter != ServerInstance->chanlist.end()) - { - FOREACH_MOD(OnChannelDelete, (this)); - ServerInstance->chanlist.erase(iter); - } + if (iter == ServerInstance->chanlist.end()) + return; + FOREACH_MOD(OnChannelDelete, (this)); + ServerInstance->chanlist.erase(iter); ClearInvites(); ServerInstance->GlobalCulls.AddItem(this); } |