aboutsummaryrefslogtreecommitdiff
path: root/src/list.rs
diff options
context:
space:
mode:
authorkrolxon <krolyxon@tutanota.com>2024-04-24 12:52:32 +0530
committerkrolxon <krolyxon@tutanota.com>2024-04-24 12:52:32 +0530
commit3f6b2bfefd54a53e675e0cffc98b704d3b8ad244 (patch)
tree0a94c5b91cf6c2f57bddec3df24a63b5ec6b9c6c /src/list.rs
parentbf11d5967fd52453292e8a5a0d9a0c618a03c4ad (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/list.rs')
-rwxr-xr-xsrc/list.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/list.rs b/src/list.rs
index d5d5524..452907d 100755
--- a/src/list.rs
+++ b/src/list.rs
@@ -27,7 +27,9 @@ impl<T> ContentList<T> {
/// Go to previous item in list
pub fn prev(&mut self) {
- if self.index != 0 {
+ if self.index == 0 {
+ self.index = self.list.len() - 1;
+ } else {
self.index -= 1;
}
}