From f84b69cad11fefa5f6615ed97170b8c12de2f3b4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 Jan 2012 15:00:06 +0000 Subject: Change the WorldMapModule to use SOG rather than SOP for the telehub ans cover a potential nullref --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 2f723ef..af9c650 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1252,20 +1252,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero) { - SceneObjectPart sop = m_scene.GetSceneObjectPart(m_scene.RegionInfo.RegionSettings.TelehubObject); - - OSDArray responsearr = new OSDArray(); - OSDMap responsemapdata = new OSDMap(); - responsemapdata["X"] = OSD.FromInteger((int)(xstart + sop.AbsolutePosition.X)); - responsemapdata["Y"] = OSD.FromInteger((int)(ystart + sop.AbsolutePosition.Y)); - // responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y)); - responsemapdata["ID"] = OSD.FromUUID(sop.UUID); - responsemapdata["Name"] = OSD.FromString(sop.Name); - responsemapdata["Extra"] = OSD.FromInteger(0); // color (unused) - responsemapdata["Extra2"] = OSD.FromInteger(0); // 0 = telehub / 1 = infohub - responsearr.Add(responsemapdata); + SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); + if (sog != null) + { + OSDArray responsearr = new OSDArray(); + OSDMap responsemapdata = new OSDMap(); + responsemapdata["X"] = OSD.FromInteger((int)(xstart + sog.AbsolutePosition.X)); + responsemapdata["Y"] = OSD.FromInteger((int)(ystart + sog.AbsolutePosition.Y)); + // responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y)); + responsemapdata["ID"] = OSD.FromUUID(sog.UUID); + responsemapdata["Name"] = OSD.FromString(sog.Name); + responsemapdata["Extra"] = OSD.FromInteger(0); // color (unused) + responsemapdata["Extra2"] = OSD.FromInteger(0); // 0 = telehub / 1 = infohub + responsearr.Add(responsemapdata); - responsemap["1"] = responsearr; + responsemap["1"] = responsearr; + } } return responsemap; -- cgit v1.1