aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/audio.c b/src/audio.c
index 79645244d..d5619e963 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -35,6 +35,8 @@ static AudioOutput * aoOutput = NULL;
static AudioOutput * shoutOutput = NULL;
static void copyAudioFormat(AudioFormat * dest, AudioFormat * src) {
+ if(!src) return;
+
dest->sampleRate = src->sampleRate;
dest->bits = src->bits;
dest->channels = src->channels;
@@ -150,10 +152,9 @@ int isCurrentAudioFormat(AudioFormat * audioFormat) {
int openAudioDevice(AudioFormat * audioFormat) {
if(!aoOutput->open || !isCurrentAudioFormat(audioFormat)) {
- if(!audioFormat) return -1;
- copyAudioFormat(&audio_format, audioFormat);
- if(shoutOutput) openAudioOutput(shoutOutput, audioFormat);
- return openAudioOutput(aoOutput, audioFormat);
+ if(audioFormat) copyAudioFormat(&audio_format, audioFormat);
+ if(shoutOutput) openAudioOutput(shoutOutput, &audio_format);
+ return openAudioOutput(aoOutput, &audio_format);
}
return 0;