Fix FindStringIndex native not returning INVALID_STRING_INDEX when string not found (bug 6144).

This commit is contained in:
Nicholas Hastings 2014-06-19 11:40:01 -04:00
parent b0e466edae
commit 291ef6fdc4

View File

@ -113,7 +113,15 @@ static cell_t FindStringIndex(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[2], &str);
return pTable->FindStringIndex(str);
int strindex = pTable->FindStringIndex(str);
// INVALID_STRING_INDEX is 65535 at time of writing, but already defined in sp inc files as -1
if (strindex == INVALID_STRING_INDEX)
{
return -1;
}
return strindex;
}
static cell_t ReadStringTable(IPluginContext *pContext, const cell_t *params)