potencial null ref

LSLKeyTest
UbitUmarov 2016-08-24 02:10:34 +01:00
parent fdea8fc96b
commit f9f35e5049
1 changed files with 15 additions and 15 deletions

View File

@ -4323,6 +4323,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
if (targetPart == null)
return;
if (targetPart.ParentGroup.AttachmentPoint != 0) if (targetPart.ParentGroup.AttachmentPoint != 0)
return; // Fail silently if attached return; // Fail silently if attached
@ -4332,8 +4334,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectGroup parentPrim = null, childPrim = null; SceneObjectGroup parentPrim = null, childPrim = null;
if (targetPart != null)
{
if (parent != 0) if (parent != 0)
{ {
parentPrim = m_host.ParentGroup; parentPrim = m_host.ParentGroup;
@ -4348,7 +4348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Required for linking // Required for linking
childPrim.RootPart.ClearUpdateSchedule(); childPrim.RootPart.ClearUpdateSchedule();
parentPrim.LinkToGroup(childPrim, true); parentPrim.LinkToGroup(childPrim, true);
}
parentPrim.TriggerScriptChangedEvent(Changed.LINK); parentPrim.TriggerScriptChangedEvent(Changed.LINK);
parentPrim.RootPart.CreateSelected = true; parentPrim.RootPart.CreateSelected = true;