Iterator fix in llavatarnamecache.cpp from v2.

This commit is contained in:
Shyotl
2011-05-01 17:24:37 -05:00
parent 2cf645e8e8
commit 0cbb9a7078

View File

@@ -577,12 +577,16 @@ void LLAvatarNameCache::eraseExpired()
{ {
F64 now = LLFrameTimer::getTotalSeconds(); F64 now = LLFrameTimer::getTotalSeconds();
cache_t::iterator it = sCache.begin(); cache_t::iterator it = sCache.begin();
for (cache_t::iterator it = sCache.begin(); it != sCache.end(); ++it) for (cache_t::iterator it = sCache.begin(); it != sCache.end();)
{ {
const LLAvatarName& av_name = it->second; const LLAvatarName& av_name = it->second;
if (av_name.mExpires < now) if (av_name.mExpires < now)
{ {
sCache.erase(it); sCache.erase(it++);
}
else
{
++it;
} }
} }
} }