Prevent null pointer dereference if there's no audio devices

BUG: 454917
This commit is contained in:
ValdikSS ValdikSS 2022-09-17 15:54:11 +03:00
parent dcf41545c2
commit 2006424e21

View file

@ -252,9 +252,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);