From 32db725dd770a52d02f86cf8a1274f68178d6844 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Fri, 5 Oct 2012 14:39:06 +0100
Subject: SceneObjectPart.SendSound can exit early if a sound module was not
 found.

---
 OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 681feea..3a39da0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2684,6 +2684,10 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="flags"></param>
         public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
         {
+            ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
+            if(soundModule == null)
+                return;
+
             volume = Util.Clip((float)volume, 0, 1);
 
             UUID ownerID = OwnerID;
@@ -2713,9 +2717,6 @@ namespace OpenSim.Region.Framework.Scenes
             if (soundID == UUID.Zero)
                 return;
 
-            ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
-            if (soundModule != null)
-            {
                 if (useMaster)
                 {
                     if (isMaster)
@@ -2761,7 +2762,6 @@ namespace OpenSim.Region.Framework.Scenes
                     else
                         soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
                 }
-            }
         }
 
         /// <summary>
-- 
cgit v1.1