aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2011-11-02 00:17:13 +0200
committerFilippos Karapetis2011-11-02 00:17:13 +0200
commit1a17bba1e4bf8fcc71517c56420e61760788eeef (patch)
tree3c7b6d3768edddc93b870748f8bbc33130bba4bd
parente674298a60e92597b52b0e66275387f78ddc4077 (diff)
downloadscummvm-rg350-1a17bba1e4bf8fcc71517c56420e61760788eeef.tar.gz
scummvm-rg350-1a17bba1e4bf8fcc71517c56420e61760788eeef.tar.bz2
scummvm-rg350-1a17bba1e4bf8fcc71517c56420e61760788eeef.zip
SCI: Fix Common::List::erase usage.
Thanks to Tron for pointing that out.
-rw-r--r--engines/sci/resource_audio.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index f3a3c8dd5b..7cf2b76eba 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -915,7 +915,7 @@ bool ResourceManager::addAudioSources() {
void ResourceManager::changeAudioDirectory(Common::String path) {
// Remove all of the audio map resource sources, as well as the audio resource sources
- for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it) {
+ for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end();) {
ResourceSource *source = *it;
ResSourceType sourceType = source->getSourceType();
@@ -925,8 +925,11 @@ void ResourceManager::changeAudioDirectory(Common::String path) {
if (source->_volumeNumber == 65535 || source->getLocationName() == "RESOURCE.SFX")
continue;
+ // erase() will move the iterator to the next element
it = _sources.erase(it);
delete source;
+ } else {
+ ++it;
}
}