From 3f0d5812b8a0296ed600fc355f21bc7a638746cc Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Tue, 24 Oct 2023 16:05:56 +0200 Subject: [PATCH] Do not iterate in while when history cursor is outside of list range --- aztec/src/main/kotlin/org/wordpress/aztec/History.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/History.kt b/aztec/src/main/kotlin/org/wordpress/aztec/History.kt index dcbd4ac50..008b0aef9 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/History.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/History.kt @@ -61,7 +61,7 @@ class History(val historyEnabled: Boolean, val historySize: Int) { return } - while (historyCursor != historyList.size && historyCursor >= 0) { + while (historyCursor in 0 until historyList.size) { historyList.removeAt(historyCursor) }