Skip to content

Commit ad858d1

Browse files
Throwing an error if no sound with given key was loaded
1 parent cf83880 commit ad858d1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ var HTML5AudioSound = new Class({
1313
* @property {HTMLAudioElement[]} tags
1414
*/
1515
this.tags = manager.game.cache.audio.get(key);
16+
if (!this.tags) {
17+
console.error('No audio loaded in cache with key: \'' + key + '\'!');
18+
return;
19+
}
1620
/**
1721
* Reference to HTML5 Audio tag used for playing sound.
1822
*

0 commit comments

Comments
 (0)