Change some chat output functions so that text is truncated at

1000 chars to avoid the exception thrown by libomv at 1100 chars.
Change string->int conversion so it copes with non-numeric chars
after the number and no longer uses a float to parse the value.
0.6.0-stable
Melanie Thielker 2008-09-02 03:43:18 +00:00
parent a5e7807612
commit 61978649ec
4 changed files with 17 additions and 7 deletions

View File

@ -161,6 +161,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
string message = e.Message; string message = e.Message;
LLUUID fromID = e.SenderUUID; LLUUID fromID = e.SenderUUID;
if(message.Length >= 1000) // libomv limit
message = message.Substring(0, 1000);
if (e.Sender != null) if (e.Sender != null)
{ {
avatar = scene.GetScenePresence(e.Sender.AgentId); avatar = scene.GetScenePresence(e.Sender.AgentId);

View File

@ -517,9 +517,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
try try
{ {
// DISPLAY ERROR INWORLD // DISPLAY ERROR INWORLD
string text = "Runtime error:\n" + e.ToString(); string text = "Runtime error:\n" + e.InnerException.ToString();
if (text.Length > 1400) if (text.Length > 1000)
text = text.Substring(0, 1400); text = text.Substring(0, 1000);
m_Engine.World.SimChat(Helpers.StringToField(text), m_Engine.World.SimChat(Helpers.StringToField(text),
ChatTypeEnum.DebugChannel, 2147483647, ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition, part.AbsolutePosition,

View File

@ -1394,8 +1394,15 @@ namespace OpenSim.Region.ScriptEngine.Shared
static public explicit operator LSLInteger(string s) static public explicit operator LSLInteger(string s)
{ {
Regex r = new Regex("^[0-9][0-9]*");
Match m = r.Match(s);
string v = m.Groups[0].Value;
if (v == String.Empty)
v = "0";
// double.Parse() used because s could be "123.9" for example. // double.Parse() used because s could be "123.9" for example.
return new LSLInteger(double.Parse(s)); return new LSLInteger(int.Parse(v));
} }
static public implicit operator LSLInteger(uint u) static public implicit operator LSLInteger(uint u)

View File

@ -432,8 +432,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
// DISPLAY ERROR INWORLD // DISPLAY ERROR INWORLD
string text = "Error compiling script:\r\n" + e.Message.ToString(); string text = "Error compiling script:\r\n" + e.Message.ToString();
if (text.Length > 1400) if (text.Length > 1000)
text = text.Substring(0, 1400); text = text.Substring(0, 1000);
World.SimChat(Helpers.StringToField(text), World.SimChat(Helpers.StringToField(text),
ChatTypeEnum.DebugChannel, 2147483647, ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition, part.AbsolutePosition,