mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-27 22:11:22 +00:00
fix: crash when setting negative position
This commit is contained in:
@@ -172,7 +172,11 @@ impl AudioPlayer {
|
||||
self.sink.get_pos().as_secs_f32()
|
||||
}
|
||||
|
||||
pub fn seek(&mut self, position: f32) -> Result<(), Box<dyn Error>> {
|
||||
pub fn seek(&mut self, mut position: f32) -> Result<(), Box<dyn Error>> {
|
||||
if position < 0.0 {
|
||||
position = 0.0;
|
||||
}
|
||||
|
||||
match self.sink.try_seek(Duration::from_secs_f32(position)) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => Err(err.into()),
|
||||
|
||||
Reference in New Issue
Block a user