mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-27 11:52:31 -06:00
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:
commit
f107e58fde
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue