mirror of https://github.com/axmolengine/axmol.git
Fixed `Scheduler::update` can lead to an infinite loop when the value of `dt` is zero.
This commit is contained in:
parent
c4af7b8c45
commit
d855722c20
|
@ -129,12 +129,17 @@ void Timer::update(float dt)
|
|||
{
|
||||
trigger(interval);
|
||||
_elapsed -= interval;
|
||||
_timesExecuted += 1;
|
||||
if (_elapsed <= 0.f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (_runForever)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
_timesExecuted += 1;
|
||||
|
||||
if (_timesExecuted > _repeat)
|
||||
{ //unschedule timer
|
||||
cancel();
|
||||
|
|
Loading…
Reference in New Issue