Fix part of #34083: crash trying to play surround .wav file in the game engine
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 7 Feb 2013 21:29:31 +0000 (21:29 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 7 Feb 2013 21:29:31 +0000 (21:29 +0000)
on Windows, it still doesn't play but it doesn't crash at least.

source/gameengine/Ketsji/KX_SoundActuator.cpp

index 2a4f2b3..5438ae5 100644 (file)
@@ -132,10 +132,13 @@ void KX_SoundActuator::play()
                handle3d->setConeVolumeOuter(m_3d.cone_outer_gain);
        }
 
-       if (loop)
-               m_handle->setLoopCount(-1);
-       m_handle->setPitch(m_pitch);
-       m_handle->setVolume(m_volume);
+       if (m_handle.get()) {
+               if (loop)
+                       m_handle->setLoopCount(-1);
+               m_handle->setPitch(m_pitch);
+               m_handle->setVolume(m_volume);
+       }
+
        m_isplaying = true;
 }