output/PipeWire: add nullptr check to SetVolume()
If the PipeWire output has not yet been enabled and no thread_loop has been created yet, a nullptr dereference in SetVolume() was possible because nullptr was passed to pw_thread_loop_lock().
This commit is contained in:
@@ -312,6 +312,14 @@ PipeWireOutput::PipeWireOutput(const ConfigBlock &block)
|
||||
void
|
||||
PipeWireOutput::SetVolume(float _volume)
|
||||
{
|
||||
if (thread_loop == nullptr) {
|
||||
/* the mixer is open (because it is a "global" mixer),
|
||||
but Enable() on this output has not yet been
|
||||
called */
|
||||
volume = _volume;
|
||||
return;
|
||||
}
|
||||
|
||||
const PipeWire::ThreadLoopLock lock(thread_loop);
|
||||
|
||||
float newvol = _volume*_volume*_volume;
|
||||
|
Reference in New Issue
Block a user