mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-02-21 06:42:02 +01:00
Fix timer bugs (disarming should not be done on non-armed ones)
This commit is contained in:
parent
d7a8f558df
commit
1839a8fb82
@ -27,7 +27,7 @@ int TimerController::arm(TimeoutHandler *which, int ms)
|
|||||||
if (this->handlers[i] == which)
|
if (this->handlers[i] == which)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
/* Not already there */
|
/* Empty slot? */
|
||||||
for (i = 0; i < this->n_handlers; i++)
|
for (i = 0; i < this->n_handlers; i++)
|
||||||
if (this->handlers[i] == NULL)
|
if (this->handlers[i] == NULL)
|
||||||
break;
|
break;
|
||||||
@ -46,6 +46,10 @@ int TimerController::arm(TimeoutHandler *which, int ms)
|
|||||||
|
|
||||||
void TimerController::disarm(TimeoutHandler *which)
|
void TimerController::disarm(TimeoutHandler *which)
|
||||||
{
|
{
|
||||||
|
/*Trying to disarm something which is not armed! */
|
||||||
|
if (which->timer_id < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
panic_if(which->timer_id >= this->n_handlers,
|
panic_if(which->timer_id >= this->n_handlers,
|
||||||
"timer_id %d is too out of bounds (max %d)\n",
|
"timer_id %d is too out of bounds (max %d)\n",
|
||||||
which->timer_id, this->n_handlers);
|
which->timer_id, this->n_handlers);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user