oops null object reference
fix potential null access when the last timer is removed and changed to iterate through the whole array to support event lists that arent in ascending order (iterating in reverse so in-place array modification via `remove` doesnt mess anything up)
This commit is contained in:
parent
239444123b
commit
1137bf65fb
|
@ -172,7 +172,18 @@ class SongSequence
|
|||
private function onUpdate():Void
|
||||
{
|
||||
if (!running) return;
|
||||
while (timers[0].time + startTime > Conductor.instance.songPosition) timers.shift().callback();
|
||||
|
||||
var len:Int = timers.length;
|
||||
for (i in 0...len)
|
||||
{
|
||||
var timer:SequenceEvent = timers[len - 1 - i];
|
||||
if (timer.time + startTime > Conductor.instance.songPosition)
|
||||
{
|
||||
timer.callback();
|
||||
timers.remove(timer);
|
||||
}
|
||||
}
|
||||
|
||||
if (completed) destroy();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue