1
0
forked from 0ad/0ad

Return in case we do not have any available JS timer slots instead of accessing OOB memory.

This was SVN commit r17263.
This commit is contained in:
leper 2015-11-15 01:09:35 +00:00
parent f1f0fa1f8f
commit 6b8dc7684a

View File

@ -904,7 +904,10 @@ void StartJsTimer(ScriptInterface::CxPrivate* pCxPrivate, unsigned int slot)
ONCE(InitJsTimers(*(pCxPrivate->pScriptInterface))); ONCE(InitJsTimers(*(pCxPrivate->pScriptInterface)));
if (slot >= MAX_JS_TIMERS) if (slot >= MAX_JS_TIMERS)
{
LOGERROR("Exceeded the maximum number of timer slots for scripts!"); LOGERROR("Exceeded the maximum number of timer slots for scripts!");
return;
}
js_start_times[slot].SetFromTimer(); js_start_times[slot].SetFromTimer();
} }
@ -912,7 +915,10 @@ void StartJsTimer(ScriptInterface::CxPrivate* pCxPrivate, unsigned int slot)
void StopJsTimer(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), unsigned int slot) void StopJsTimer(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), unsigned int slot)
{ {
if (slot >= MAX_JS_TIMERS) if (slot >= MAX_JS_TIMERS)
{
LOGERROR("Exceeded the maximum number of timer slots for scripts!"); LOGERROR("Exceeded the maximum number of timer slots for scripts!");
return;
}
TimerUnit now; TimerUnit now;
now.SetFromTimer(); now.SetFromTimer();