From 24ffcbd9adc8ca02f5b60d2e0ebdac761f3644aa Mon Sep 17 00:00:00 2001 From: Eddy Jansson Date: Sun, 20 Mar 2022 17:23:34 +0100 Subject: [PATCH] audio: Set error message on dsp init failure. if SDL_EnumUnixAudioDevices() fails to find any devices, set an error message on the exit path. Without this, SDL_Init() could fail without any message available in SDL_GetError(). --- src/audio/dsp/SDL_dspaudio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 8d4ee9435..531612a29 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -308,6 +308,7 @@ DSP_Init(SDL_AudioDriverImpl * impl) InitTimeDevicesExist = SDL_FALSE; SDL_EnumUnixAudioDevices(0, look_for_devices_test); if (!InitTimeDevicesExist) { + SDL_SetError("dsp: No such audio device"); return SDL_FALSE; /* maybe try a different backend. */ }