mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-03 05:59:59 +00:00
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
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue