win-wasapi: Fix potential null pointer deref in enumeration

This commit is contained in:
jp9000 2017-05-28 15:30:06 -07:00
parent 847b3013fc
commit b5581938ca

View File

@ -20,7 +20,7 @@ string GetDeviceName(IMMDevice *device)
PropVariantInit(&nameVar);
res = store->GetValue(PKEY_Device_FriendlyName, &nameVar);
if (SUCCEEDED(res)) {
if (SUCCEEDED(res) && nameVar.pwszVal && *nameVar.pwszVal) {
size_t len = wcslen(nameVar.pwszVal);
size_t size;