From 1a46feda43dff022d5a369fb85612b2670fe97e4 Mon Sep 17 00:00:00 2001 From: Julian Laubstein Date: Mon, 20 Oct 2014 14:46:24 +0200 Subject: [PATCH] Added error handling to load command --- src/Bindings/PluginManager.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 43507a5fb..ef9638339 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -1525,6 +1525,15 @@ bool cPluginManager::DisablePlugin(const AString & a_PluginName) bool cPluginManager::LoadPlugin(const AString & a_PluginName) { + PluginMap map = GetAllPlugins(); + + for(auto plugin_entry : map) + { + if(plugin_entry.first == a_PluginName) + { + return false; + } + } return AddPlugin(new cPluginLua(a_PluginName.c_str())); } @@ -1827,7 +1836,8 @@ bool cPluginManager::DoWithPlugin(const AString & a_PluginName, cPluginCallback bool cPluginManager::AddPlugin(cPlugin * a_Plugin) { - m_Plugins[a_Plugin->GetDirectory()] = a_Plugin; + m_Plugins[a_Plugin->GetDirectory()] = a_Plugin; + if (a_Plugin->Initialize()) { // Initialization OK