From 3a9e6b86345d02f119bd20facd2858c698924eca Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Sun, 8 Jan 2017 18:38:18 -0500 Subject: [PATCH] check if no sound at index before playing --- src/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.js b/src/index.js index d8e69f0..0f0fe8b 100644 --- a/src/index.js +++ b/src/index.js @@ -108,6 +108,8 @@ AudioPlayer.prototype.loadSounds = function (sounds) { }; AudioPlayer.prototype.playSound = function (index) { + if (!this.soundPlayers[index]) return; + this.soundPlayers[index].start(); var storedContext = this;