Merge pull request #9080 from lat9nq/sdl-audio-not-null

sdl2_sink: Avoid loading a null string into a vector
This commit is contained in:
Morph 2022-10-17 02:56:38 -04:00 committed by GitHub
commit f107e58fde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,7 +230,9 @@ std::vector<std::string> ListSDLSinkDevices(bool capture) {
const int device_count = SDL_GetNumAudioDevices(capture); const int device_count = SDL_GetNumAudioDevices(capture);
for (int i = 0; i < device_count; ++i) { for (int i = 0; i < device_count; ++i) {
device_list.emplace_back(SDL_GetAudioDeviceName(i, 0)); if (const char* name = SDL_GetAudioDeviceName(i, capture)) {
device_list.emplace_back(name);
}
} }
return device_list; return device_list;