Prevent null pointer dereference if there's no audio devices

BUG: 454917


(cherry picked from commit 2006424e21)
This commit is contained in:
ValdikSS ValdikSS 2022-09-17 15:54:11 +03:00 committed by Aleix Pol Gonzalez
parent 678e3901b0
commit c6c6b1f443

View file

@ -262,9 +262,19 @@ bool SystemvolumePlugin::sendSinkList()
unsigned int deviceCount;
devices->GetCount(&deviceCount);
if (!deviceCount) {
qWarning("No audio devices detected");
return false;
}
IMMDevice *defaultDevice = nullptr;
deviceEnumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &defaultDevice);
if (!defaultDevice) {
qWarning("No default audio device detected");
return false;
}
LPWSTR defaultId = NULL;
defaultDevice->GetId(&defaultId);