From 6e3f0a140c902f0372ad7a0b9a8dc2b79866f907 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 11 Oct 2020 06:55:35 +0100 Subject: [PATCH] handle a sp null ref better --- .../World/LightShare/EnvironmentModule.cs | 17 ++++++++++------- OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs index 9309e3bc76..571d293be9 100644 --- a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs @@ -708,7 +708,14 @@ namespace OpenSim.Region.CoreModules.World.LightShare ViewerEnvironment VEnv = null; ScenePresence sp = m_scene.GetScenePresence(agentID); - if (sp != null && sp.Environment != null) + if(sp == null) + { + response.StatusCode = (int)HttpStatusCode.ServiceUnavailable; + response.AddHeader("Retry-After", "10"); + return; + } + + if(sp.Environment != null) VEnv = sp.Environment; else { @@ -718,14 +725,10 @@ namespace OpenSim.Region.CoreModules.World.LightShare if (land != null && land.LandData != null && land.LandData.Environment != null) VEnv = land.LandData.Environment; } - if(VEnv == null) - VEnv = GetRegionEnvironment(); } + if (VEnv == null) + VEnv = GetRegionEnvironment(); - //OSD d = VEnv.ToWLOSD(UUID.Zero, regionID); - //string env = OSDParser.SerializeLLSDXmlString(d); - - //if (String.IsNullOrEmpty(env)) byte[] envBytes = VEnv.ToCapWLBytes(UUID.Zero, regionID); if(envBytes == null) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dc0d8ae8ee..04d7a29480 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4185,10 +4185,6 @@ namespace OpenSim.Region.Framework.Scenes CacheUserName(null, acd); } - if (CapsModule != null) - { - CapsModule.ActivateCaps(acd.circuitcode); - } //if (vialogin) //{ @@ -4229,6 +4225,11 @@ namespace OpenSim.Region.Framework.Scenes } } + if (CapsModule != null) + { + CapsModule.ActivateCaps(acd.circuitcode); + } + return true; }