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.
avinationmerge
BlueWall 2012-01-26 00:33:34 -05:00
parent 093469c33c
commit a6abecf5fa
1 changed files with 13 additions and 11 deletions

View File

@ -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);
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);
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);
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
}
}
else
{