From 653a98e891dcd97b55010900bacc4d033958756a Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 3 Oct 2012 17:39:13 +0100 Subject: Fix a viewer crash issue Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 52d96bc..7fa6f05 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4006,7 +4006,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); - m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); + if (text.Length > 254) + text = text.Remove(254); + + byte[] data; + do + { + data = Util.UTF8.GetBytes(text); + if (data.Length > 254) + text = text.Substring(0, text.Length - 1); + } while (data.Length > 254); + + m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); } -- cgit v1.1