add some sanity checking to HandleAgentRequestSit handler

avinationmerge
dahlia 2013-01-10 20:21:18 -08:00 committed by Melanie
parent 6e9092421b
commit 2eb0d8b617
1 changed files with 12 additions and 2 deletions

View File

@ -6601,9 +6601,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit;
if (handlerAgentRequestSit != null) if (handlerAgentRequestSit != null)
if (!(agentRequestSit.AgentData == null
|| agentRequestSit.TargetObject == null
|| agentRequestSit.TargetObject.TargetID == null
|| agentRequestSit.TargetObject.Offset == null))
{
var sp = m_scene.GetScenePresence(agentRequestSit.AgentData.AgentID);
if (sp == null || sp.ParentID != 0) // ignore packet if agent is already sitting
return true;
handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
} }
}
return true; return true;
} }