diff options
author | Sean Dague | 2008-04-11 13:51:11 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-11 13:51:11 +0000 |
commit | f337cb205d449c3dc40a29c2d2deecaf082e057c (patch) | |
tree | e169416b1daad6e8de698ad8933d15815e38a965 | |
parent | * Discerned between AddProfile and UpdateProfile in region registration (diff) | |
download | opensim-SC-f337cb205d449c3dc40a29c2d2deecaf082e057c.zip opensim-SC-f337cb205d449c3dc40a29c2d2deecaf082e057c.tar.gz opensim-SC-f337cb205d449c3dc40a29c2d2deecaf082e057c.tar.bz2 opensim-SC-f337cb205d449c3dc40a29c2d2deecaf082e057c.tar.xz |
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.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 6a0b3e2..a2bc397 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -434,13 +434,15 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
434 | { | 434 | { |
435 | m_host.AddScriptLPS(1); | 435 | m_host.AddScriptLPS(1); |
436 | LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID); | 436 | LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID); |
437 | if ((number>=0)&&(number <= SenseList.Length)) | 437 | if (SenseList != null) |
438 | { | 438 | { |
439 | LLUUID SensedUUID = (LLUUID)SenseList.Data[number]; | 439 | if ((number >= 0) && (number <= SenseList.Length)) |
440 | return resolveName(SensedUUID); | 440 | { |
441 | LLUUID SensedUUID = (LLUUID)SenseList.Data[number]; | ||
442 | return resolveName(SensedUUID); | ||
443 | } | ||
441 | } | 444 | } |
442 | else | 445 | return String.Empty; |
443 | return String.Empty; | ||
444 | } | 446 | } |
445 | 447 | ||
446 | public LLUUID uuidDetectedKey(int number) | 448 | public LLUUID uuidDetectedKey(int number) |
@@ -479,15 +481,18 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
479 | public EntityBase entityDetectedKey(int number) | 481 | public EntityBase entityDetectedKey(int number) |
480 | { | 482 | { |
481 | LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID); | 483 | LSL_Types.list SenseList = m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.GetSensorList(m_localID, m_itemID); |
482 | if ((number >= 0) && (number < SenseList.Length)) | 484 | if (SenseList != null) |
483 | { | 485 | { |
484 | LLUUID SensedUUID = (LLUUID)SenseList.Data[number]; | 486 | if ((number >= 0) && (number < SenseList.Length)) |
485 | EntityBase SensedObject = null; | ||
486 | lock (World.Entities) | ||
487 | { | 487 | { |
488 | World.Entities.TryGetValue(SensedUUID, out SensedObject); | 488 | LLUUID SensedUUID = (LLUUID)SenseList.Data[number]; |
489 | EntityBase SensedObject = null; | ||
490 | lock (World.Entities) | ||
491 | { | ||
492 | World.Entities.TryGetValue(SensedUUID, out SensedObject); | ||
493 | } | ||
494 | return SensedObject; | ||
489 | } | 495 | } |
490 | return SensedObject; | ||
491 | } | 496 | } |
492 | return null; | 497 | return null; |
493 | } | 498 | } |