From b9deebb59d872169eb164101b83b6ba957583ee2 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Mon, 3 Oct 2016 09:55:31 +0200 Subject: [PATCH] It's perfectly valid to call is_sample_stopped() even if the sample was already stopped. So remove the assert and replace it with an if-test --- simgear/sound/soundmgr_openal.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/simgear/sound/soundmgr_openal.cxx b/simgear/sound/soundmgr_openal.cxx index 247d11a8..e1b8c626 100644 --- a/simgear/sound/soundmgr_openal.cxx +++ b/simgear/sound/soundmgr_openal.cxx @@ -757,11 +757,12 @@ void SGSoundMgr::sample_destroy( SGSoundSample *sample ) bool SGSoundMgr::is_sample_stopped(SGSoundSample *sample) { #ifdef ENABLE_SOUND - assert(sample->is_valid_source()); - unsigned int source = sample->get_source(); - int result; - alGetSourcei( source, AL_SOURCE_STATE, &result ); - return (result == AL_STOPPED); + if ( sample->is_valid_source() ) { + ALint source = sample->get_source(); + ALint result; + alGetSourcei( source, AL_SOURCE_STATE, &result ); + return (result == AL_STOPPED); + } #else return true; #endif