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

This commit is contained in:
Erik Hofman
2016-10-03 09:55:31 +02:00
parent 906813c90b
commit b9deebb59d

View File

@@ -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