3
0
Fork 0
forked from suyu/suyu

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);
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;