mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
catch possible null refs
This commit is contained in:
@@ -45,16 +45,23 @@ namespace OpenSim.Framework.Monitoring
|
||||
// Asking for an update here means that the updater cannot access this value without infinite recursion.
|
||||
// XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
|
||||
// called by the pull action and just return the value.
|
||||
if (StatType == StatType.Pull)
|
||||
PullAction(this);
|
||||
try
|
||||
{
|
||||
if (StatType == StatType.Pull)
|
||||
PullAction(this);
|
||||
|
||||
long c = Consequent;
|
||||
long c = Consequent;
|
||||
|
||||
// Avoid any chance of a multi-threaded divide-by-zero
|
||||
if (c == 0)
|
||||
// Avoid any chance of a multi-threaded divide-by-zero
|
||||
if (c == 0)
|
||||
return 0;
|
||||
|
||||
return (double)Antecedent / c * 100;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 0;
|
||||
|
||||
return (double)Antecedent / c * 100;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
|
||||
@@ -81,12 +81,18 @@ namespace OpenSim.Framework.Monitoring
|
||||
// Asking for an update here means that the updater cannot access this value without infinite recursion.
|
||||
// XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
|
||||
// called by the pull action and just return the value.
|
||||
if (StatType == StatType.Pull)
|
||||
PullAction(this);
|
||||
try
|
||||
{
|
||||
if (StatType == StatType.Pull)
|
||||
PullAction(this);
|
||||
|
||||
return m_value;
|
||||
return m_value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_value = value;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
"jobengine",
|
||||
StatType.Pull,
|
||||
MeasuresOfInterest.None,
|
||||
stat => stat.Value = JobEngine.JobsWaiting,
|
||||
stat => stat.Value = JobEngine == null ? 0 : JobEngine.JobsWaiting,
|
||||
StatVerbosity.Debug));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
|
||||
Reference in New Issue
Block a user