From d1a860751524c60d4e225f74ae887346f3b89dd1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 18 Jan 2019 17:23:46 -0800 Subject: Handle a missing default WASAPI device ID --- Alc/backends/wasapi.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Alc') 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 &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); } -- cgit v1.2.3