From f99dae03cb1f5ab7215de1f7741befc3f0856840 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Sep 2013 23:00:40 +0100 Subject: Fix bug where using PRIM_LINK_TARGET with only two remaining list items (e.g. link number then PRIM_ROTATION) would not return the parameter Extended regression test for this case --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- .../Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) (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 bd451a5..975bf2d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8202,7 +8202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else remaining = GetAgentParams((ScenePresence)entity, rules, ref result); - if (remaining == null || remaining.Length <= 2) + if (remaining == null || remaining.Length < 2) return result; int linknumber = remaining.GetLSLIntegerItem(0); @@ -8786,7 +8786,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_LINK_TARGET: // TODO: Should be issuing a runtime script warning in this case. - if (remain < 3) + if (remain < 2) return null; return rules.GetSublist(idx, -1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs index ff87cc1..ed61dc0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs @@ -100,6 +100,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.That(resList.Length, Is.EqualTo(1)); } + // Check 2 prim case + { + LSL_List resList + = apiGrp1.llGetLinkPrimitiveParams( + 1, + new LSL_List( + new LSL_Integer(ScriptBaseClass.PRIM_ROTATION), + new LSL_Integer(ScriptBaseClass.PRIM_LINK_TARGET), + new LSL_Integer(2), + new LSL_Integer(ScriptBaseClass.PRIM_ROTATION))); + + Assert.That(resList.Length, Is.EqualTo(2)); + } + // Check invalid parameters are ignored { LSL_List resList -- cgit v1.1