diff options
Diffstat (limited to 'alc/backends/wasapi.cpp')
-rw-r--r-- | alc/backends/wasapi.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index c5282fcb..dccbeba2 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -577,7 +577,8 @@ struct DeviceHelper final : private IMMNotificationClient Platform::String^ devIfPath = devid.empty() ? (flow == eRender ? MediaDevice::GetDefaultAudioRenderId(deviceRole) : MediaDevice::GetDefaultAudioCaptureId(deviceRole)) : ref new Platform::String(devid.data()); - + if (!devIfPath) + return E_POINTER; Concurrency::task<DeviceInformation^> createDeviceOp( DeviceInformation::CreateFromIdAsync(devIfPath, nullptr, DeviceInformationKind::DeviceInterface)); auto status = createDeviceOp.then([&](DeviceInformation^ deviceInfo) @@ -674,6 +675,8 @@ struct DeviceHelper final : private IMMNotificationClient const auto deviceRole = Windows::Media::Devices::AudioDeviceRole::Default; auto DefaultAudioId = flowdir == eRender ? MediaDevice::GetDefaultAudioRenderId(deviceRole) : MediaDevice::GetDefaultAudioCaptureId(deviceRole); + if (!DefaultAudioId) + return defaultId; Concurrency::task<DeviceInformation ^> createDefaultOp(DeviceInformation::CreateFromIdAsync(DefaultAudioId, nullptr, DeviceInformationKind::DeviceInterface)); auto task_status = createDefaultOp.then([&defaultId](DeviceInformation ^ deviceInfo) { |