From: Kurt Taylor <krtaylor@us.ibm.com>

Attached is the second half of the fix for 821 - this is the null reference
check for llDetectedName and the other *Detected* function.
0.6.0-stable
Sean Dague 2008-04-11 13:51:11 +00:00
parent cbf9fcfac5
commit f337cb205d
1 changed files with 16 additions and 11 deletions

View File

@ -434,13 +434,15 @@ namespace OpenSim.Region.ScriptEngine.Common
{
m_host.AddScriptLPS(1);
LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID);
if ((number>=0)&&(number <= SenseList.Length))
if (SenseList != null)
{
LLUUID SensedUUID = (LLUUID)SenseList.Data[number];
return resolveName(SensedUUID);
if ((number >= 0) && (number <= SenseList.Length))
{
LLUUID SensedUUID = (LLUUID)SenseList.Data[number];
return resolveName(SensedUUID);
}
}
else
return String.Empty;
return String.Empty;
}
public LLUUID uuidDetectedKey(int number)
@ -479,15 +481,18 @@ namespace OpenSim.Region.ScriptEngine.Common
public EntityBase entityDetectedKey(int number)
{
LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID);
if ((number >= 0) && (number < SenseList.Length))
if (SenseList != null)
{
LLUUID SensedUUID = (LLUUID)SenseList.Data[number];
EntityBase SensedObject = null;
lock (World.Entities)
if ((number >= 0) && (number < SenseList.Length))
{
World.Entities.TryGetValue(SensedUUID, out SensedObject);
LLUUID SensedUUID = (LLUUID)SenseList.Data[number];
EntityBase SensedObject = null;
lock (World.Entities)
{
World.Entities.TryGetValue(SensedUUID, out SensedObject);
}
return SensedObject;
}
return SensedObject;
}
return null;
}