From f87219975dbf3a1cdea1773f519c1a04e7bef745 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2018 00:56:31 +0100 Subject: bug fix: avoid null ref on trigger soundi if source is a avatar --- .../Region/CoreModules/World/Sound/SoundModule.cs | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Sound') diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 14c230a..64f46df 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -169,6 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) { + float radius; SceneObjectPart part; ScenePresence ssp = null; if (!m_scene.TryGetSceneObjectPart(objectID, out part)) @@ -177,28 +178,31 @@ namespace OpenSim.Region.CoreModules.World.Sound return; if (!ssp.ParcelAllowThisAvatarSounds) return; + + radius = MaxDistance; } else { 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; - if (!ssp.ParcelAllowThisAvatarSounds) + if(!ssp.ParcelAllowThisAvatarSounds) return; + } - } - float radius = (float)part.SoundRadius; - if (radius == 0) - { - radius = MaxDistance; - part.SoundRadius = MaxDistance; + radius = (float)part.SoundRadius; + if(radius == 0) + { + radius = MaxDistance; + part.SoundRadius = MaxDistance; + } + part.SoundFlags = 0; } - part.SoundFlags = 0; radius *= radius; m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) -- cgit v1.1