aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
diff options
context:
space:
mode:
authorSignpostMarv2012-08-16 15:32:20 +0100
committerJustin Clark-Casey (justincc)2012-08-17 23:08:24 +0100
commit74f5253a366cefa5222a813f4ed349db93c08acc (patch)
tree6f7ca7e96420e4228a1f34879a6d1b4953f20040 /OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-74f5253a366cefa5222a813f4ed349db93c08acc.zip
opensim-SC_OLD-74f5253a366cefa5222a813f4ed349db93c08acc.tar.gz
opensim-SC_OLD-74f5253a366cefa5222a813f4ed349db93c08acc.tar.bz2
opensim-SC_OLD-74f5253a366cefa5222a813f4ed349db93c08acc.tar.xz
attempt to handle InvalidCastException in a manner similar to Second Life
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs15
1 files changed, 13 insertions, 2 deletions
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)