Fix bug that allow index out of bounds on next
This commit is contained in:
parent
af63d50dc5
commit
e926b63140
|
|
@ -65,7 +65,7 @@ impl Queue {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_track(&mut self) -> Option<Track> {
|
pub fn next_track(&mut self) -> Option<Track> {
|
||||||
if self.current_position < self.tracks.len() as u32 {
|
if self.current_position < self.tracks.len() as u32 - 1 {
|
||||||
self.current_position += 1;
|
self.current_position += 1;
|
||||||
Some(self.tracks[self.current_position as usize].clone())
|
Some(self.tracks[self.current_position as usize].clone())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue