From a6abecf5fa5de0a78b1d77ef0aee1efafb255a2f Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Thu, 26 Jan 2012 00:33:34 -0500
Subject: Change references from sop to sog and add protection from null ref

	I had code made additions to the map module that was based on the earlier work that I did before Melanie made improvements. Updating the new code to incorporate the same changes.
---
 .../CoreModules/World/WorldMap/WorldMapModule.cs   | 24 ++++++++++++----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 1a9313b..4ae96f0 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -489,18 +489,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
                     List<mapItemReply> mapitems = new List<mapItemReply>();
                     mapItemReply mapitem = new mapItemReply();
 
-                    SceneObjectPart sop = m_scene.GetSceneObjectPart(m_scene.RegionInfo.RegionSettings.TelehubObject);
-
-                    mapitem = new mapItemReply();
-                    mapitem.x = (uint)(xstart + sop.AbsolutePosition.X);
-                    mapitem.y = (uint)(ystart + sop.AbsolutePosition.Y);
-                    mapitem.id = UUID.Zero;
-                    mapitem.name = sop.Name;
-                    mapitem.Extra = 0; // color (not used)
-                    mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub
-                    mapitems.Add(mapitem);
+                    SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
+                    if (sog != null)
+                    {
+                        mapitem = new mapItemReply();
+                        mapitem.x = (uint)(xstart + sog.AbsolutePosition.X);
+                        mapitem.y = (uint)(ystart + sog.AbsolutePosition.Y);
+                        mapitem.id = UUID.Zero;
+                        mapitem.name = sog.Name;
+                        mapitem.Extra = 0; // color (not used)
+                        mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub
+                        mapitems.Add(mapitem);
 
-                    remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
+                        remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
+                    }
                 }
                 else
                 {
-- 
cgit v1.1