]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Merge pull request #971 from SaberUK/master+numeric-xline
[user/henk/code/inspircd.git] / src / channels.cpp
index fdf0f76e1abdbb4f20539b63749cda5546d3cfb6..948538ff460d15162048800ceea8c77a218f5954 100644 (file)
@@ -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()) || (iter->second != this))
+               return;
 
+       FOREACH_MOD(OnChannelDelete, (this));
+       ServerInstance->chanlist.erase(iter);
        ClearInvites();
        ServerInstance->GlobalCulls.AddItem(this);
 }