Prevent a nullref if SimStatsReporter tries to report on a sim where psysics are

not yet initialized
avinationmerge
Melanie 2012-09-03 13:25:31 +02:00
parent 63e6666f22
commit 7cfcca87c6
1 changed files with 17 additions and 14 deletions

View File

@ -438,23 +438,26 @@ namespace OpenSim.Region.Framework.Scenes
} }
// Extra statistics that aren't currently sent to clients // Extra statistics that aren't currently sent to clients
lock (m_lastReportedExtraSimStats) if (m_scene.PhysicsScene != null)
{ {
m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; lock (m_lastReportedExtraSimStats)
Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
if (physicsStats != null)
{ {
foreach (KeyValuePair<string, float> tuple in physicsStats) m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
if (physicsStats != null)
{ {
// FIXME: An extremely dirty hack to divide MS stats per frame rather than per second foreach (KeyValuePair<string, float> tuple in physicsStats)
// Need to change things so that stats source can indicate whether they are per second or {
// per frame. // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second
if (tuple.Key.EndsWith("MS")) // Need to change things so that stats source can indicate whether they are per second or
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe; // per frame.
else if (tuple.Key.EndsWith("MS"))
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe;
else
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
}
} }
} }
} }