Throw error instead of crash when calling SetTeamScore between maps (bug 5718, r=psychonic).

This commit is contained in:
Kyle Sanderson 2013-07-18 11:38:04 -04:00
parent 69d8b1c30d
commit 1f88f1f3f6

View File

@ -164,6 +164,11 @@ static cell_t GetTeamScore(IPluginContext *pContext, const cell_t *params)
static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params) static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params)
{ {
if (!g_pSM->IsMapRunning())
{
return pContext->ThrowNativeError("Cannot set team score when no map is running");
}
int teamindex = params[1]; int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName) if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{ {