sound/alsa: fix missing StreamWithIdNotFound check

stop() was not returning an error if stream_id was invalid, it was
succeeding.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
This commit is contained in:
Manos Pitsidianakis 2023-12-13 13:15:52 +02:00 committed by Manos Pitsidianakis
parent c0c75d36ff
commit 30fb9b7766

View File

@ -645,12 +645,14 @@ impl AudioBackend for AlsaBackend {
}
fn stop(&self, id: u32) -> CrateResult<()> {
if let Some(Err(err)) = self
if let Err(err) = self
.streams
.write()
.unwrap()
.get_mut(id as usize)
.map(|s| s.state.stop())
.ok_or_else(|| Error::StreamWithIdNotFound(id))?
.state
.stop()
{
log::error!("Stream {} stop {}", id, err);
}