mirror of
https://github.com/opensim/opensim.git
synced 2026-07-13 19:14:51 +08:00
Fix an npc delete race condition with LSL sensors where an initial presence check could succeed but then the npc removed before the subequent npc check.
The resulting null would cause an exception. We now check for null before looking at SenseAsAgent. Hopefully fixes http://opensimulator.org/mantis/view.php?id=5872
This commit is contained in:
@@ -445,17 +445,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
Vector3 toRegionPos;
|
||||
double dis;
|
||||
|
||||
Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence)
|
||||
Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
|
||||
{
|
||||
if ((ts.type & NPC) == 0
|
||||
&& presence.PresenceType == PresenceType.Npc
|
||||
&& !npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent)
|
||||
return;
|
||||
if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
|
||||
{
|
||||
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||
if (npcData == null || !npcData.SenseAsAgent)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ts.type & AGENT) == 0
|
||||
&& (presence.PresenceType == PresenceType.User
|
||||
|| npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent))
|
||||
return;
|
||||
if ((ts.type & AGENT) == 0)
|
||||
{
|
||||
if (presence.PresenceType == PresenceType.User)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||
if (npcData != null && npcData.SenseAsAgent)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user