mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Try to guard against value being -1
This commit is contained in:
parent
473aed632d
commit
34c1c5a361
@ -951,15 +951,19 @@ static void audio_mixer_play_stop_cb(audio_mixer_sound_t *sound, unsigned reason
|
||||
case AUDIO_MIXER_SOUND_FINISHED:
|
||||
audio_mixer_destroy(sound);
|
||||
|
||||
if (audio_mixer_streams[idx].buf != NULL)
|
||||
free(audio_mixer_streams[idx].buf);
|
||||
audio_mixer_streams[idx].state = AUDIO_STREAM_STATE_NONE;
|
||||
audio_mixer_streams[idx].volume = 0.0f;
|
||||
audio_mixer_streams[idx].buf = NULL;
|
||||
audio_mixer_streams[idx].stop_cb = NULL;
|
||||
audio_mixer_streams[idx].handle = NULL;
|
||||
audio_mixer_streams[idx].voice = NULL;
|
||||
audio_mixer_current_max_idx--;
|
||||
if (idx >= 0)
|
||||
{
|
||||
unsigned i = (unsigned)idx;
|
||||
if (audio_mixer_streams[i].buf != NULL)
|
||||
free(audio_mixer_streams[i].buf);
|
||||
audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE;
|
||||
audio_mixer_streams[i].volume = 0.0f;
|
||||
audio_mixer_streams[i].buf = NULL;
|
||||
audio_mixer_streams[i].stop_cb = NULL;
|
||||
audio_mixer_streams[i].handle = NULL;
|
||||
audio_mixer_streams[i].voice = NULL;
|
||||
audio_mixer_current_max_idx--;
|
||||
}
|
||||
break;
|
||||
case AUDIO_MIXER_SOUND_STOPPED:
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user