Skip to content

Commit 1801687

Browse files
committed
update(cmds/plugins): Fix crash
1 parent a232546 commit 1801687

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/commands/CommandsManager.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ class CommandsManager
2121
Command *FetchCommand(std::string cmd);
2222
bool RegisterCommand(std::string plugin_name, std::string cmd, Command *command);
2323
bool UnregisterCommand(std::string cmd);
24-
std::vector<std::string> FetchCommandsByPlugin(std::string plugin_name) { return this->commandsByPlugin.at(plugin_name); }
24+
std::vector<std::string> FetchCommandsByPlugin(std::string plugin_name)
25+
{
26+
if (this->commandsByPlugin.find(plugin_name) == this->commandsByPlugin.end())
27+
return {};
28+
return this->commandsByPlugin.at(plugin_name);
29+
}
2530

2631
std::map<std::string, Command *> GetCommands()
2732
{

src/components/Plugins/src/Plugin.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ void Plugin::StopPlugin()
4848
{
4949
void *OnPluginStop = this->FetchFunction("Internal_OnPluginStop");
5050
if (OnPluginStop)
51-
{
5251
reinterpret_cast<OnPluginStopFunction>(OnPluginStop)();
53-
}
5452

5553
dlclose(this->m_hModule);
5654
this->functions.clear();

0 commit comments

Comments
 (0)