mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
audio: Make sure we don't write to a NULL pointer.
(This _probably_ never happens in the current codebase, but just in case.)
This commit is contained in:
@@ -1119,7 +1119,9 @@ int SDL_ClearAudioStream(SDL_AudioStream *stream)
|
|||||||
|
|
||||||
SDL_LockMutex(stream->lock);
|
SDL_LockMutex(stream->lock);
|
||||||
SDL_ClearDataQueue(stream->queue, (size_t)stream->packetlen * 2);
|
SDL_ClearDataQueue(stream->queue, (size_t)stream->packetlen * 2);
|
||||||
|
if (stream->history_buffer != NULL) {
|
||||||
SDL_memset(stream->history_buffer, SDL_GetSilenceValueForFormat(stream->src_spec.format), stream->history_buffer_frames * stream->src_spec.channels * sizeof (float));
|
SDL_memset(stream->history_buffer, SDL_GetSilenceValueForFormat(stream->src_spec.format), stream->history_buffer_frames * stream->src_spec.channels * sizeof (float));
|
||||||
|
}
|
||||||
stream->future_buffer_filled_frames = 0;
|
stream->future_buffer_filled_frames = 0;
|
||||||
stream->flushed = SDL_FALSE;
|
stream->flushed = SDL_FALSE;
|
||||||
SDL_UnlockMutex(stream->lock);
|
SDL_UnlockMutex(stream->lock);
|
||||||
|
Reference in New Issue
Block a user