sdl2_sink: Check for null string when loading SDL audio devices
Attempting to place a null string into a vector of strings causes an error that closes the application. Don't.
This commit is contained in:
parent
d574bb4610
commit
5c7eef3756
@ -230,7 +230,10 @@ 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));
|
||||
const char* name = SDL_GetAudioDeviceName(i, 0);
|
||||
if (name != nullptr) {
|
||||
device_list.emplace_back(name);
|
||||
}
|
||||
}
|
||||
|
||||
return device_list;
|
||||
|
Loading…
Reference in New Issue
Block a user