From 789492d1a9bb686e593b08dd8c4ca3af26652bee Mon Sep 17 00:00:00 2001 From: mo8it Date: Thu, 29 Aug 2024 00:32:58 +0200 Subject: [PATCH] The number of exercises can't be zero, but still --- src/app_state.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app_state.rs b/src/app_state.rs index cc77711a..2a205682 100644 --- a/src/app_state.rs +++ b/src/app_state.rs @@ -301,7 +301,7 @@ impl AppState { // Return the index of the next pending exercise or `None` if all exercises are done. fn next_pending_exercise_ind(&self) -> Option { - if self.current_exercise_ind == self.exercises.len() - 1 { + if self.current_exercise_ind + 1 == self.exercises.len() { // The last exercise is done. // Search for exercises not done from the start. return self.exercises[..self.current_exercise_ind]