summaryrefslogtreecommitdiff
path: root/modules/extra/ns_set_misc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/extra/ns_set_misc.cpp')
-rw-r--r--modules/extra/ns_set_misc.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp
index 8ab54fd05..87113fb67 100644
--- a/modules/extra/ns_set_misc.cpp
+++ b/modules/extra/ns_set_misc.cpp
@@ -107,10 +107,23 @@ class NSSetMisc : public Module
for (std::map<Anope::string, CommandInfo *>::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it)
{
if (set)
- set->DelSubcommand(it->first);
+ {
+ Command *c = set->FindSubcommand(it->second->Name);
+ if (c)
+ {
+ set->DelSubcommand(c);
+ delete c;
+ }
+ }
if (saset)
- saset->DelSubcommand(it->first);
- delete it->second;
+ {
+ Command *c = saset->FindSubcommand(it->second->Name);
+ if (c)
+ {
+ saset->DelSubcommand(c);
+ delete c;
+ }
+ }
}
this->Commands.clear();