diff --git a/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp b/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp index 10e0f00..fc3947f 100644 --- a/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp +++ b/src/tabcontrollers/audiomanager/AudioManagerWindows.cpp @@ -457,7 +457,7 @@ IMMDevice* LPCWSTR id ) { IMMDevice* pDevice; - if ( deviceEnumerator->GetDevice( id, &pDevice ) < 0 ) + if ( !id || deviceEnumerator->GetDevice( id, &pDevice ) < 0 ) { return nullptr; } @@ -606,6 +606,10 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow, micAudioEndpointVolume = getAudioEndpointVolume( micAudioDevice ); } + else if ( !pwstrDefaultDeviceId ) + { + LOG( WARNING ) << "No recording device available."; + } else { std::wstring_convert> @@ -632,7 +636,11 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow, playbackAudioDevice->Release(); } playbackAudioDevice = device; - if ( !playbackAudioDevice ) + if ( !pwstrDefaultDeviceId ) + { + LOG( WARNING ) << "No playback device available."; + } + else if ( !playbackAudioDevice ) { std::wstring_convert> converter;