diff options
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b7b5e8e..255fc8e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7674,6 +7674,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7674 | } | 7674 | } |
7675 | } | 7675 | } |
7676 | } | 7676 | } |
7677 | catch (InvalidCastException e) | ||
7678 | { | ||
7679 | ShoutError(e.Message); | ||
7680 | } | ||
7677 | finally | 7681 | finally |
7678 | { | 7682 | { |
7679 | if (positionChanged) | 7683 | if (positionChanged) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index d848b2a..562433d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -560,12 +560,23 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
560 | else if (m_data[itemIndex] is LSL_Types.LSLString) | 560 | else if (m_data[itemIndex] is LSL_Types.LSLString) |
561 | return new LSLInteger(m_data[itemIndex].ToString()); | 561 | return new LSLInteger(m_data[itemIndex].ToString()); |
562 | else | 562 | else |
563 | throw new InvalidCastException(); | 563 | throw new InvalidCastException(string.Format( |
564 | "{0} expected but {1} given", | ||
565 | typeof(LSL_Types.LSLInteger).Name, | ||
566 | m_data[itemIndex] != null ? | ||
567 | m_data[itemIndex].GetType().Name : "null")); | ||
564 | } | 568 | } |
565 | 569 | ||
566 | public LSL_Types.Vector3 GetVector3Item(int itemIndex) | 570 | public LSL_Types.Vector3 GetVector3Item(int itemIndex) |
567 | { | 571 | { |
568 | return (LSL_Types.Vector3)m_data[itemIndex]; | 572 | if(m_data[itemIndex] is LSL_Types.Vector3) |
573 | return (LSL_Types.Vector3)m_data[itemIndex]; | ||
574 | else | ||
575 | throw new InvalidCastException(string.Format( | ||
576 | "{0} expected but {1} given", | ||
577 | typeof(LSL_Types.Vector3).Name, | ||
578 | m_data[itemIndex] != null ? | ||
579 | m_data[itemIndex].GetType().Name : "null")); | ||
569 | } | 580 | } |
570 | 581 | ||
571 | public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) | 582 | public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) |