aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/backends/wasapi.cpp6
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);
}