diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 62a804f9b..72351dd5a 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -328,7 +328,7 @@ void LLAudioEngine::idle(F32 max_decode_time) //Also add sources that might be able to start playing to a priority queue. //Only sources without channels, or are waiting for a syncmaster, should be added to this queue. std::priority_queue >,SourcePriorityComparator> queue; - for (source_map::iterator iter = mAllSources.begin(); iter != mAllSources.end(); ++iter) + for (source_map::iterator iter = mAllSources.begin(); iter != mAllSources.end();) { LLAudioSource *sourcep = iter->second; @@ -344,6 +344,9 @@ void LLAudioEngine::idle(F32 max_decode_time) continue; } + // Increment iter here (it is not used anymore), so we can use continue below to move on to the next source. + ++iter; + LLAudioData *adp = sourcep->getCurrentData(); //If there is no current data at all, or if it hasn't loaded, we must skip this source. if (!adp || !adp->getBuffer())