From a2c19847b4bb9b2335622bfc9757e6f7a2971c7d Mon Sep 17 00:00:00 2001
From: Kim King
Date: Mon, 16 May 2011 05:57:08 -0400
Subject: ScriptEngine/Shared: Fix bug 5473 (v2).

---
 OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region/ScriptEngine')

diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 298d664..461b473 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -1536,6 +1536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
         public struct LSLInteger
         {
             public int value;
+            private static readonly Regex castRegex = new Regex(@"(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*(-?|\+?)[0-9][0-9]*)");
 
             #region Constructors
             public LSLInteger(int i)
@@ -1555,9 +1556,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
 
             public LSLInteger(string s)
             {
-                Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)");
-                Match m = r.Match(s);
+                Match m = castRegex.Match(s);
                 string v = m.Groups[0].Value;
+                // Leading plus sign is allowed, but ignored
+                v = v.Replace("+", "");
 
                 if (v == String.Empty)
                 {
-- 
cgit v1.1