bug fix: avoid null ref on trigger soundi if source is a avatar

httptests
UbitUmarov 2018-05-15 00:56:31 +01:00
parent 570440256b
commit f87219975d
1 changed files with 14 additions and 10 deletions

View File

@ -169,6 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
public virtual void TriggerSound( public virtual void TriggerSound(
UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle)
{ {
float radius;
SceneObjectPart part; SceneObjectPart part;
ScenePresence ssp = null; ScenePresence ssp = null;
if (!m_scene.TryGetSceneObjectPart(objectID, out part)) if (!m_scene.TryGetSceneObjectPart(objectID, out part))
@ -177,28 +178,31 @@ namespace OpenSim.Region.CoreModules.World.Sound
return; return;
if (!ssp.ParcelAllowThisAvatarSounds) if (!ssp.ParcelAllowThisAvatarSounds)
return; return;
radius = MaxDistance;
} }
else else
{ {
SceneObjectGroup grp = part.ParentGroup; SceneObjectGroup grp = part.ParentGroup;
if (grp.IsAttachment) if(grp.IsAttachment)
{ {
if (!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp)) if(!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp))
return; return;
if (!ssp.ParcelAllowThisAvatarSounds) if(!ssp.ParcelAllowThisAvatarSounds)
return; return;
}
} }
float radius = (float)part.SoundRadius; radius = (float)part.SoundRadius;
if (radius == 0) if(radius == 0)
{ {
radius = MaxDistance; radius = MaxDistance;
part.SoundRadius = MaxDistance; part.SoundRadius = MaxDistance;
} }
part.SoundFlags = 0; part.SoundFlags = 0;
}
radius *= radius; radius *= radius;
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)