nicolasgramlich/AndEngine — pull request #72 by edbartley (2012-04-09 21:44:21+00:00)
Title: Prevent potential for Endless Loop in TimerHandler

If a TimerHandler is constructed with pTimerSeconds <= 0 an endless loop will be created in the onUpdate() while loop because in the code fragment

while(this.mTimerSecondsElapsed >= this.mTimerSeconds) {..}

'this.mTimerSecondsElapsed' will always be greater than 'this.mTimerSeconds'.

The same problem could occur if setTimerSeconds(...) is called with pTimerSeconds <= 0;

Another way to fix this is to add an additional test for mTimerSeconds <= 0 in the onUpdate method, but that will add unnecessary overhead.