From a432a07005c700222de612f408fe2921d2348825 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 21 Jul 2008 13:40:08 +0000 Subject: Mantis#1798. Thank you kindly, StrawberryFride for a patch that: Fixes a couple of places where null reference exceptions were being caught and ignored rather than null checks being performed. --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 16 ++++------------ OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 57d3e5c..399cbf6 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -95,22 +95,14 @@ namespace OpenSim.Region.Environment.Scenes // If we're not doing the initial set // Then we've got to remove the previous // event handler - try - { + + if (_PhyScene != null) _PhyScene.OnPhysicsCrash -= physicsBasedCrash; - } - catch (NullReferenceException) - { - // This occurs when storing to _PhyScene the first time. - // Is there a better way to check the event handler before - // getting here - // This can be safely ignored. We're setting the first inital - // there are no event handler's registered. - } _PhyScene = value; - _PhyScene.OnPhysicsCrash += physicsBasedCrash; + if (_PhyScene != null) + _PhyScene.OnPhysicsCrash += physicsBasedCrash; } } diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 60b5c10..f46aba4 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -153,7 +153,7 @@ namespace OpenSim.Region.Environment.Scenes try { IEstateModule estateModule = m_scene.RequestModuleInterface(); - statpack.Region.RegionFlags = estateModule.GetRegionFlags(); + statpack.Region.RegionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0; } catch (Exception) { -- cgit v1.1