mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
Make llGetLinkPrimitiveParams() abort and return existing list of params when it encounters an invalid link number, rather than throwing an exception
Addresses http://opensimulator.org/mantis/view.php?id=6768 Thanks to talun for the patch on that commit - in the end I took a different approach that also deals with invalid PRIM_LINK_TARGET However, not yet generating the same warning on invalid PRIM_LINK_TARGET as seen on LL grid This commit also adds regression tests for some cases of llGetLinkPrimitiveParams()
This commit is contained in:
@@ -8190,6 +8190,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
while (true)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LSL API]: GetEntityParams has {0} rules with scene entity named {1}",
|
||||
// rules.Length, entity != null ? entity.Name : "NULL");
|
||||
|
||||
if (entity == null)
|
||||
return result;
|
||||
|
||||
if (entity is SceneObjectPart)
|
||||
remaining = GetPrimParams((SceneObjectPart)entity, rules, ref result);
|
||||
else
|
||||
@@ -8400,7 +8407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
while (idx < rules.Length)
|
||||
{
|
||||
int code = (int)rules.GetLSLIntegerItem(idx++);
|
||||
int remain = rules.Length-idx;
|
||||
int remain = rules.Length - idx;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
@@ -8777,7 +8784,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
));
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
|
||||
if(remain < 3)
|
||||
|
||||
// TODO: Should be issuing a runtime script warning in this case.
|
||||
if (remain < 3)
|
||||
return null;
|
||||
|
||||
return rules.GetSublist(idx, -1);
|
||||
|
||||
Reference in New Issue
Block a user