Prevent a null ref when getting the velocity of an avatar during login or

logout.
avinationmerge
Melanie 2012-06-07 00:24:07 +02:00
parent bdc62144ae
commit 5876a4d392
1 changed files with 3 additions and 2 deletions

View File

@ -2536,11 +2536,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
Vector3 vel; Vector3 vel = Vector3.Zero;
if (m_host.ParentGroup.IsAttachment) if (m_host.ParentGroup.IsAttachment)
{ {
ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
if (avatar != null)
vel = avatar.Velocity; vel = avatar.Velocity;
} }
else else