Prevent null pointer dereference if there's no audio devices
BUG: 454917
(cherry picked from commit 2006424e21
)
This commit is contained in:
parent
678e3901b0
commit
c6c6b1f443
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue