From e926b63140bcd5ffe75cf74c7867f483076b38c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20M=C3=BCndelein?= Date: Sun, 4 Jun 2023 08:41:00 +0200 Subject: [PATCH] Fix bug that allow index out of bounds on next --- crabidy-core/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crabidy-core/src/lib.rs b/crabidy-core/src/lib.rs index 1e6c534..3f68780 100644 --- a/crabidy-core/src/lib.rs +++ b/crabidy-core/src/lib.rs @@ -65,7 +65,7 @@ impl Queue { } pub fn next_track(&mut self) -> Option { - if self.current_position < self.tracks.len() as u32 { + if self.current_position < self.tracks.len() as u32 - 1 { self.current_position += 1; Some(self.tracks[self.current_position as usize].clone()) } else {