summaryrefslogtreecommitdiff
path: root/src/commands/cmd_unloadmodule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/cmd_unloadmodule.cpp')
-rw-r--r--src/commands/cmd_unloadmodule.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/commands/cmd_unloadmodule.cpp b/src/commands/cmd_unloadmodule.cpp
index 5aecd22dd..c3ae49d1c 100644
--- a/src/commands/cmd_unloadmodule.cpp
+++ b/src/commands/cmd_unloadmodule.cpp
@@ -41,14 +41,16 @@ CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameter
return CMD_FAILURE;
}
- if (ServerInstance->Modules->Unload(parameters[0].c_str()))
+ Module* m = ServerInstance->Modules->Find(parameters[0]);
+ if (m && ServerInstance->Modules->Unload(m))
{
ServerInstance->SNO->WriteGlobalSno('a', "MODULE UNLOADED: %s unloaded %s", user->nick.c_str(), parameters[0].c_str());
user->WriteNumeric(973, "%s %s :Module successfully unloaded.",user->nick.c_str(), parameters[0].c_str());
}
else
{
- user->WriteNumeric(972, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
+ user->WriteNumeric(972, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(),
+ m ? ServerInstance->Modules->LastError().c_str() : "No such module");
return CMD_FAILURE;
}