From 61e094e5cf323ff6d40ab800f5dd927522d72c55 Mon Sep 17 00:00:00 2001 From: "Cathy J. Fitzpatrick" Date: Tue, 21 May 2013 01:39:04 -0500 Subject: [PATCH] Fix crash when soundmanager does not load --- js/battle.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/battle.js b/js/battle.js index 5b975256a..56c7969ff 100644 --- a/js/battle.js +++ b/js/battle.js @@ -41,11 +41,15 @@ function BattleSoundLibrary() { if (this.effectCache[url]) { return this.effectCache[url]; } - return this.effectCache[url] = soundManager.createSound({ + this.effectCache[url] = soundManager.createSound({ id: url, url: Tools.resourcePrefix + url, volume: this.effectVolume }); + if (!this.effectCache[url]) { + this.effectCache[url] = this.soundPlaceholder; + } + return this.effectCache[url]; }; this.playEffect = function(url) { if (!this.mute) this.loadEffect(url).setVolume(this.effectVolume).play();