From 78c74739fc004df0f3866543e8833c24afba00bb Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Fri, 5 Jan 2018 19:35:44 +0100 Subject: [PATCH] Fixed sounds array truncate logic in update method --- v3/src/sound/BaseSoundManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v3/src/sound/BaseSoundManager.js b/v3/src/sound/BaseSoundManager.js index e856fce8e..3583879ba 100644 --- a/v3/src/sound/BaseSoundManager.js +++ b/v3/src/sound/BaseSoundManager.js @@ -201,9 +201,9 @@ var BaseSoundManager = new Class({ this.sounds.sort(function (s1, s2) { return (s1.pendingRemove === s2.pendingRemove) ? 0 : s1 ? 1 : -1; }); - for (var i = this.sounds.length - 1; i >= 0; i--) { - if (!this.sounds[i].pendingRemove) { - this.sounds.splice(this.sounds.length - 1 - i); + for (var i = 0; i < this.sounds.length; i++) { + if (this.sounds[i].pendingRemove) { + this.sounds.length = i; break; } }