fixed a bug in get_func_id (thanks P34CH_34732)

This commit is contained in:
David Anderson 2006-10-02 06:12:02 +00:00
parent 12ecf026db
commit 00380cfe4c

View File

@ -3301,19 +3301,30 @@ static cell AMX_NATIVE_CALL get_func_id(AMX *amx, cell *params)
CPluginMngr::CPlugin *plugin; CPluginMngr::CPlugin *plugin;
if (params[2] < 0) if (params[2] < 0)
{
plugin = g_plugins.findPluginFast(amx); plugin = g_plugins.findPluginFast(amx);
else } else {
plugin = g_plugins.findPlugin(params[2]); plugin = g_plugins.findPlugin(params[2]);
}
if (!plugin) if (!plugin)
{
return -1; return -1;
}
if (!plugin->isValid())
{
return -1;
}
int len; int len;
const char *funcName = get_amxstring(amx, params[1], 0, len); const char *funcName = get_amxstring(amx, params[1], 0, len);
int index, err; int index, err;
if ((err = amx_FindPublic(plugin->getAMX(), funcName, &index)) != AMX_ERR_NONE) if ((err = amx_FindPublic(plugin->getAMX(), funcName, &index)) != AMX_ERR_NONE)
{
index = -1; index = -1;
}
return index; return index;
} }