Prevent null pointer dereference if there's no audio devices
BUG: 454917
This commit is contained in:
parent
dcf41545c2
commit
2006424e21
1 changed files with 10 additions and 0 deletions
|
@ -252,9 +252,19 @@ bool SystemvolumePlugin::sendSinkList()
|
||||||
unsigned int deviceCount;
|
unsigned int deviceCount;
|
||||||
devices->GetCount(&deviceCount);
|
devices->GetCount(&deviceCount);
|
||||||
|
|
||||||
|
if (!deviceCount) {
|
||||||
|
qWarning("No audio devices detected");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
IMMDevice *defaultDevice = nullptr;
|
IMMDevice *defaultDevice = nullptr;
|
||||||
deviceEnumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &defaultDevice);
|
deviceEnumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &defaultDevice);
|
||||||
|
|
||||||
|
if (!defaultDevice) {
|
||||||
|
qWarning("No default audio device detected");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LPWSTR defaultId = NULL;
|
LPWSTR defaultId = NULL;
|
||||||
defaultDevice->GetId(&defaultId);
|
defaultDevice->GetId(&defaultId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue