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

user_profiles
Justin Clark-Casey (justincc) 2013-02-14 00:19:28 +00:00
parent bcb172301d
commit 69d0e168fb
1 changed files with 7 additions and 2 deletions

View File

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