aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/sound
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-31 19:37:51 -0400
committerPaul Gilbert2016-08-31 19:37:51 -0400
commit1fe8b6382519456ea26f1023576193c3c4e41b88 (patch)
treeae77a9a89f00de660c61dbedc6db7a19217c7906 /engines/titanic/sound
parent062048f0c175f942525dff38fb400780331e635f (diff)
downloadscummvm-rg350-1fe8b6382519456ea26f1023576193c3c4e41b88.tar.gz
scummvm-rg350-1fe8b6382519456ea26f1023576193c3c4e41b88.tar.bz2
scummvm-rg350-1fe8b6382519456ea26f1023576193c3c4e41b88.zip
TITANIC: Fix crash when loading second sound
Diffstat (limited to 'engines/titanic/sound')
-rw-r--r--engines/titanic/sound/sound.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp
index 7e791c2ba5..045f5aad91 100644
--- a/engines/titanic/sound/sound.cpp
+++ b/engines/titanic/sound/sound.cpp
@@ -87,13 +87,16 @@ void CSound::stopChannel(int channel) {
}
void CSound::checkSounds() {
- for (CSoundItemList::iterator i = _sounds.begin(); i != _sounds.end(); ++i) {
+ for (CSoundItemList::iterator i = _sounds.begin(); i != _sounds.end(); ) {
CSoundItem *soundItem = *i;
+
if (soundItem->_active && soundItem->_freeFlag) {
if (_soundManager.isActive(soundItem->_waveFile)) {
- _sounds.remove(soundItem);
+ i = _sounds.erase(i);
delete soundItem;
}
+ } else {
+ ++i;
}
}
}