Make sure that keys exist in arrays before trying to access them.

0.6.8-post-fixes
Michael Cortez 2009-10-05 12:09:45 -07:00 committed by Melanie
parent 90d1ef9e4a
commit f4726f4bcc
1 changed files with 9 additions and 3 deletions

View File

@ -148,9 +148,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
UUID[] CurrentKeys = new UUID[m_clientRequestIDInfo.Count]; UUID[] CurrentKeys = new UUID[m_clientRequestIDInfo.Count];
foreach (UUID key in CurrentKeys) foreach (UUID key in CurrentKeys)
{ {
if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout) if (m_clientRequestIDInfo.ContainsKey(key))
{ {
m_clientRequestIDInfo.Remove(key); if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout)
{
m_clientRequestIDInfo.Remove(key);
}
} }
} }
} }
@ -476,7 +479,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
foreach (string key in binBucketOSD.Keys) foreach (string key in binBucketOSD.Keys)
{ {
m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); if (binBucketOSD.ContainsKey(key))
{
m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString());
}
} }
} }