Commit 9f16a34d authored by Max Kellermann's avatar Max Kellermann

audio: don't allow isCurrentAudioFormat(NULL)

Passing NULL to this function doesn't make sense, and complicates its implementation. The one caller which might pass NULL should rather check this.
parent a53047af
...@@ -222,8 +222,9 @@ void finishAudioDriver(void) ...@@ -222,8 +222,9 @@ void finishAudioDriver(void)
int isCurrentAudioFormat(const struct audio_format *audioFormat) int isCurrentAudioFormat(const struct audio_format *audioFormat)
{ {
return audioFormat == NULL || assert(audioFormat != NULL);
audio_format_equals(audioFormat, &audio_format);
return audio_format_equals(audioFormat, &audio_format);
} }
static void syncAudioDeviceStates(void) static void syncAudioDeviceStates(void)
...@@ -292,7 +293,8 @@ int openAudioDevice(const struct audio_format *audioFormat) ...@@ -292,7 +293,8 @@ int openAudioDevice(const struct audio_format *audioFormat)
if (!audioOutputArray) if (!audioOutputArray)
return -1; return -1;
if (!audioOpened || !isCurrentAudioFormat(audioFormat)) { if (!audioOpened ||
(audioFormat != NULL && !isCurrentAudioFormat(audioFormat))) {
flushAudioBuffer(); flushAudioBuffer();
if (audioFormat != NULL) if (audioFormat != NULL)
audio_format = *audioFormat; audio_format = *audioFormat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment