Fix a very unlikely-to-occur NullReferenceException race condition in llPushObject() where the code assumed that the physics actor it null-checked would still be null when it invoked a method on it

0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-14 00:19:28 +00:00
parent 12201bf7f4
commit 37ab587f27
1 changed files with 7 additions and 2 deletions

View File

@ -4541,6 +4541,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
if (pushAllowed)
{
float distance = (PusheePos - m_host.AbsolutePosition).Length();
@ -4569,17 +4570,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
applied_linear_impulse *= scaling_factor;
}
if (pusheeIsAvatar)
{
if (pusheeav != null)
{
if (pusheeav.PhysicsActor != null)
PhysicsActor pa = pusheeav.PhysicsActor;
if (pa != null)
{
if (local != 0)
{
applied_linear_impulse *= m_host.GetWorldRotation();
}
pusheeav.PhysicsActor.AddForce(applied_linear_impulse, true);
pa.AddForce(applied_linear_impulse, true);
}
}
}