AudioServer: Query pins of the asked device and not the current one

This commit is contained in:
Bananymous 2026-03-23 22:57:49 +02:00
parent dedeebbfbe
commit c563efcd1c
1 changed files with 6 additions and 1 deletions

View File

@ -68,7 +68,12 @@ bool AudioServer::on_client_packet(int fd, LibAudio::Packet packet)
response = m_audio_devices.size(); response = m_audio_devices.size();
break; break;
case LibAudio::Packet::QueryPins: case LibAudio::Packet::QueryPins:
response = device().total_pins; if (packet.parameter >= m_audio_devices.size())
{
dwarnln("Client tried to get pins of device {} while there are only {}", packet.parameter, m_audio_devices.size());
return false;
}
response = m_audio_devices[packet.parameter].total_pins;
break; break;
case LibAudio::Packet::GetDevice: case LibAudio::Packet::GetDevice:
response = m_current_audio_device; response = m_current_audio_device;