diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 64fe7a8e36..3cf7b2aa39 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1336,6 +1336,7 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor actor = PhysicsActor; if (actor == null) { + SafeSendControlsToScripts(flagsForScripts); return; } @@ -1512,20 +1513,25 @@ namespace OpenSim.Region.Framework.Scenes if (update_movementflag && ParentID == 0) Animator.UpdateMovementAnimations(); - lock (scriptedcontrols) - { - if (scriptedcontrols.Count > 0) - { - // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script - // (e.g., a walking script) checks which animation is active it will be the correct animation. - SendControlToScripts(flagsForScripts); - } - } + SafeSendControlsToScripts(flagsForScripts); } m_scene.EventManager.TriggerOnClientMovement(this); } + private void SafeSendControlsToScripts(uint flagsForScripts) + { + lock (scriptedcontrols) + { + if (scriptedcontrols.Count > 0) + { + // Notify the scripts only after calling UpdateMovementAnimations(), so that if a script + // (e.g., a walking script) checks which animation is active it will be the correct animation. + SendControlToScripts(flagsForScripts); + } + } + } + /// /// Calculate an update to move the presence to the set target. ///