From 3f6b2bfefd54a53e675e0cffc98b704d3b8ad244 Mon Sep 17 00:00:00 2001 From: krolxon Date: Wed, 24 Apr 2024 12:52:32 +0530 Subject: Fix wrong songs playing when queue is not empty if we are playing a song which is in the middle of somewhere in queue. it will play the wrong song, since the index points to wrong song --- src/connection.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/connection.rs') diff --git a/src/connection.rs b/src/connection.rs index e0e788d..fa8cc78 100755 --- a/src/connection.rs +++ b/src/connection.rs @@ -70,10 +70,11 @@ impl Connection { self.conn.play().unwrap(); } else { self.conn.push(song)?; + let len: u32 = (self.conn.queue().unwrap().len() - 1).try_into().unwrap(); + self.conn.switch(len)?; if self.conn.status()?.state == State::Stop { self.conn.play()?; } - self.conn.next().unwrap(); } Ok(()) -- cgit v1.2.3