Skip to content

Commit 78c7473

Browse files
Fixed sounds array truncate logic in update method
1 parent 7e22368 commit 78c7473

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

v3/src/sound/BaseSoundManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ var BaseSoundManager = new Class({
201201
this.sounds.sort(function (s1, s2) {
202202
return (s1.pendingRemove === s2.pendingRemove) ? 0 : s1 ? 1 : -1;
203203
});
204-
for (var i = this.sounds.length - 1; i >= 0; i--) {
205-
if (!this.sounds[i].pendingRemove) {
206-
this.sounds.splice(this.sounds.length - 1 - i);
204+
for (var i = 0; i < this.sounds.length; i++) {
205+
if (this.sounds[i].pendingRemove) {
206+
this.sounds.length = i;
207207
break;
208208
}
209209
}

0 commit comments

Comments
 (0)