From f9f35e504973da9610ffcb09502a4ae32ea8eec3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Aug 2016 02:10:34 +0100 Subject: [PATCH] potencial null ref --- .../Shared/Api/Implementation/LSL_Api.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3241598b89..f45676eecd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4323,6 +4323,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); + if (targetPart == null) + return; if (targetPart.ParentGroup.AttachmentPoint != 0) return; // Fail silently if attached @@ -4332,23 +4334,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectGroup parentPrim = null, childPrim = null; - if (targetPart != null) + if (parent != 0) { - if (parent != 0) - { - parentPrim = m_host.ParentGroup; - childPrim = targetPart.ParentGroup; - } - else - { - parentPrim = targetPart.ParentGroup; - childPrim = m_host.ParentGroup; - } - - // Required for linking - childPrim.RootPart.ClearUpdateSchedule(); - parentPrim.LinkToGroup(childPrim, true); + parentPrim = m_host.ParentGroup; + childPrim = targetPart.ParentGroup; } + else + { + parentPrim = targetPart.ParentGroup; + childPrim = m_host.ParentGroup; + } + + // Required for linking + childPrim.RootPart.ClearUpdateSchedule(); + parentPrim.LinkToGroup(childPrim, true); + parentPrim.TriggerScriptChangedEvent(Changed.LINK); parentPrim.RootPart.CreateSelected = true;