1
0
Fork 0

Fixed a crash in the plugin reload code.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1415 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-04-27 14:08:23 +00:00
parent fb58acf27c
commit 03551b034f
1 changed files with 12 additions and 2 deletions

View File

@ -100,6 +100,8 @@ void cPluginManager::ReloadPluginsNow(void)
FindPlugins();
cServer::BindBuiltInConsoleCommands();
cIniFile IniFile("settings.ini");
if (!IniFile.ReadFile())
{
@ -138,7 +140,6 @@ void cPluginManager::ReloadPluginsNow(void)
{
LOG("Loaded %i plugin(s)", GetNumPlugins());
}
cServer::BindBuiltInConsoleCommands();
}
@ -1048,6 +1049,8 @@ void cPluginManager::UnloadPluginsNow()
RemovePlugin(m_Plugins.begin()->second);
}
m_Commands.clear();
m_ConsoleCommands.clear();
//SquirrelVM::Shutdown(); // This breaks shit
}
@ -1251,7 +1254,14 @@ bool cPluginManager::BindConsoleCommand(const AString & a_Command, cPlugin * a_P
CommandMap::iterator cmd = m_ConsoleCommands.find(a_Command);
if (cmd != m_ConsoleCommands.end())
{
LOGWARNING("Console command \"%s\" is already bound to plugin \"%s\".", a_Command.c_str(), cmd->second.m_Plugin->GetName().c_str());
if (cmd->second.m_Plugin == NULL)
{
LOGWARNING("Console command \"%s\" is already bound internally by MCServer.", a_Command.c_str());
}
else
{
LOGWARNING("Console command \"%s\" is already bound to plugin \"%s\".", a_Command.c_str(), cmd->second.m_Plugin->GetName().c_str());
}
return false;
}