diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-04-24 12:52:32 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-04-24 12:52:32 +0530 |
| commit | 3f6b2bfefd54a53e675e0cffc98b704d3b8ad244 (patch) | |
| tree | 0a94c5b91cf6c2f57bddec3df24a63b5ec6b9c6c /src/connection.rs | |
| parent | bf11d5967fd52453292e8a5a0d9a0c618a03c4ad (diff) | |
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
Diffstat (limited to 'src/connection.rs')
| -rwxr-xr-x | src/connection.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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(()) |
