aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-05-25 11:44:24 +0000
committerFilippos Karapetis2009-05-25 11:44:24 +0000
commit4470dada57cffc23dd9b07a4667eecd04733b677 (patch)
tree0ef30452fc3a648b80ae164a8261fb8e8b299a92
parent43d38512f1fdbf6e763c1b4d1807e0c7c79ff3a6 (diff)
downloadscummvm-rg350-4470dada57cffc23dd9b07a4667eecd04733b677.tar.gz
scummvm-rg350-4470dada57cffc23dd9b07a4667eecd04733b677.tar.bz2
scummvm-rg350-4470dada57cffc23dd9b07a4667eecd04733b677.zip
Fixed crash when starting KQ6
svn-id: r40885
-rw-r--r--engines/sci/engine/ksound.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index a5b30d13b2..f1d8ab7e45 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -999,6 +999,9 @@ reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
Audio::Mixer *mixer = g_system->getMixer();
int sampleLen = 0;
+ if (!s->sound.audioResource)
+ s->sound.audioResource = new AudioResource();
+
switch (UKPV(0)) {
case kSci1AudioWPlay:
case kSci1AudioPlay: {
@@ -1039,13 +1042,7 @@ reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, UKPV(1));
break;
case kSci1AudioLanguage:
- if (s->sound.audioResource)
- delete s->sound.audioResource;
-
- // The audio resource is freed when freeing all resources
- s->sound.audioResource = new AudioResource();
s->sound.audioResource->setAudioLang(SKPV(1));
-
break;
default:
warning("kDoAudio: Unhandled case %d", UKPV(0));