diff options
author | Chris Robinson <[email protected]> | 2019-01-18 17:23:46 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-18 17:23:46 -0800 |
commit | d1a860751524c60d4e225f74ae887346f3b89dd1 (patch) | |
tree | 4e5f502085f7f73e956e4a93057a55fa4b41a8f2 /Alc | |
parent | 40c6f74bb71fe6e963b8bf270b59e80e00a098b0 (diff) |
Handle a missing default WASAPI device ID
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/wasapi.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp index 6fe97cb0..8904ca3a 100644 --- a/Alc/backends/wasapi.cpp +++ b/Alc/backends/wasapi.cpp @@ -289,7 +289,7 @@ WCHAR *get_device_id(IMMDevice *device) HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, al::vector<DevMap> &list) { IMMDeviceCollection *coll; - HRESULT hr = devenum->EnumAudioEndpoints(flowdir, DEVICE_STATE_ACTIVE, &coll); + HRESULT hr{devenum->EnumAudioEndpoints(flowdir, DEVICE_STATE_ACTIVE, &coll)}; if(FAILED(hr)) { ERR("Failed to enumerate audio endpoints: 0x%08lx\n", hr); @@ -320,10 +320,10 @@ HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, al::vecto hr = coll->Item(i, &device); if(FAILED(hr)) continue; - WCHAR *devid = get_device_id(device); + WCHAR *devid{get_device_id(device)}; if(devid) { - if(wcscmp(devid, defdevid) != 0) + if(!defdevid || wcscmp(devid, defdevid) != 0) add_device(device, devid, list); CoTaskMemFree(devid); } |