diff options
author | UbitUmarov | 2018-05-15 00:56:31 +0100 |
---|---|---|
committer | UbitUmarov | 2018-05-15 00:56:31 +0100 |
commit | f87219975dbf3a1cdea1773f519c1a04e7bef745 (patch) | |
tree | 315ff6ce7effd7b631fb6e52fccaa7133b1e240e | |
parent | avoid potencial out of range issues (diff) | |
download | opensim-SC-f87219975dbf3a1cdea1773f519c1a04e7bef745.zip opensim-SC-f87219975dbf3a1cdea1773f519c1a04e7bef745.tar.gz opensim-SC-f87219975dbf3a1cdea1773f519c1a04e7bef745.tar.bz2 opensim-SC-f87219975dbf3a1cdea1773f519c1a04e7bef745.tar.xz |
bug fix: avoid null ref on trigger soundi if source is a avatar
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | 24 |
1 files changed, 14 insertions, 10 deletions
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 | |||
169 | public virtual void TriggerSound( | 169 | public virtual void TriggerSound( |
170 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) | 170 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) |
171 | { | 171 | { |
172 | float radius; | ||
172 | SceneObjectPart part; | 173 | SceneObjectPart part; |
173 | ScenePresence ssp = null; | 174 | ScenePresence ssp = null; |
174 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) | 175 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) |
@@ -177,28 +178,31 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
177 | return; | 178 | return; |
178 | if (!ssp.ParcelAllowThisAvatarSounds) | 179 | if (!ssp.ParcelAllowThisAvatarSounds) |
179 | return; | 180 | return; |
181 | |||
182 | radius = MaxDistance; | ||
180 | } | 183 | } |
181 | else | 184 | else |
182 | { | 185 | { |
183 | SceneObjectGroup grp = part.ParentGroup; | 186 | SceneObjectGroup grp = part.ParentGroup; |
184 | 187 | ||
185 | if (grp.IsAttachment) | 188 | if(grp.IsAttachment) |
186 | { | 189 | { |
187 | if (!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp)) | 190 | if(!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp)) |
188 | return; | 191 | return; |
189 | 192 | ||
190 | if (!ssp.ParcelAllowThisAvatarSounds) | 193 | if(!ssp.ParcelAllowThisAvatarSounds) |
191 | return; | 194 | return; |
195 | |||
192 | } | 196 | } |
193 | } | ||
194 | 197 | ||
195 | float radius = (float)part.SoundRadius; | 198 | radius = (float)part.SoundRadius; |
196 | if (radius == 0) | 199 | if(radius == 0) |
197 | { | 200 | { |
198 | radius = MaxDistance; | 201 | radius = MaxDistance; |
199 | part.SoundRadius = MaxDistance; | 202 | part.SoundRadius = MaxDistance; |
203 | } | ||
204 | part.SoundFlags = 0; | ||
200 | } | 205 | } |
201 | part.SoundFlags = 0; | ||
202 | 206 | ||
203 | radius *= radius; | 207 | radius *= radius; |
204 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 208 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |