Do a ScenePresence null check in HGMessageTransferModule.SendIMToScene() to stop a NullReferenceException being thrown if an HG IM is sent to a simulator running multiple regions

This is an attempt to address http://opensimulator.org/mantis/view.php?id=5791
iar_mods
Justin Clark-Casey (justincc) 2011-11-14 15:24:02 +00:00
parent e61ea79c72
commit 49ec85ae15
2 changed files with 4 additions and 1 deletions

View File

@ -225,12 +225,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
foreach (Scene scene in m_Scenes)
{
ScenePresence sp = scene.GetScenePresence(toAgentID);
if(!sp.IsChildAgent)
if(sp != null && !sp.IsChildAgent)
{
scene.EventManager.TriggerIncomingInstantMessage(gim);
successful = true;
}
}
if (!successful)
{
// If the message can't be delivered to an agent, it

View File

@ -2854,6 +2854,8 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero;
AbsolutePosition = pos;
// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
AddToPhysicalScene(isFlying);
}
}