The number of exercises can't be zero, but still

This commit is contained in:
mo8it 2024-08-29 00:32:58 +02:00
parent afc320bed4
commit 789492d1a9

View file

@ -301,7 +301,7 @@ impl AppState {
// Return the index of the next pending exercise or `None` if all exercises are done. // Return the index of the next pending exercise or `None` if all exercises are done.
fn next_pending_exercise_ind(&self) -> Option<usize> { fn next_pending_exercise_ind(&self) -> Option<usize> {
if self.current_exercise_ind == self.exercises.len() - 1 { if self.current_exercise_ind + 1 == self.exercises.len() {
// The last exercise is done. // The last exercise is done.
// Search for exercises not done from the start. // Search for exercises not done from the start.
return self.exercises[..self.current_exercise_ind] return self.exercises[..self.current_exercise_ind]