소스 검색

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().
Eddy Jansson 4 년 전
부모
커밋
24ffcbd9ad
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      src/audio/dsp/SDL_dspaudio.c

+ 1 - 0
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. */
     }