From de99228cd89feec02009aebb3eeac1f594b43ccf Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Thu, 2 Feb 2017 15:25:36 -0500 Subject: [PATCH] check for own property in for (var _ in _ ) --- src/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 0bd8af5..4eddc04 100644 --- a/src/index.js +++ b/src/index.js @@ -178,7 +178,7 @@ function AudioPlayer (audioEngine) { this.clearEffects(); // sound players that are currently playing, indexed by the sound's md5 - this.activeSoundPlayers = Object.create(null); + this.activeSoundPlayers = {}; } /** @@ -209,8 +209,10 @@ AudioPlayer.prototype.playSound = function (md5) { // remove sounds that are not playing from the active sound players array for (var id in this.activeSoundPlayers) { - if (!this.activeSoundPlayers[id].isPlaying) { - delete this.activeSoundPlayers[id]; + if (this.activeSoundPlayers.hasOwnProperty(id)) { + if (!this.activeSoundPlayers[id].isPlaying) { + delete this.activeSoundPlayers[id]; + } } }