From 98f8eedecd72b0afe6a0f099a3641a1cc6be2698 Mon Sep 17 00:00:00 2001 From: rstular Date: Sat, 6 May 2023 13:42:26 +0200 Subject: [PATCH] fix: remove `count` instead of `count + 1` instructions with `removeInstructions` (#167) Co-authored-by: oSumAtrIX BREAKING-CHANGE: This alters the behaviour of the function. Instead of removing `count + 1` instructions, this now removes `count` instructions. --- src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt index 723c377..f828631 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt @@ -39,7 +39,7 @@ fun MutableMethodImplementation.replaceInstructions(index: Int, instructions: Li } fun MutableMethodImplementation.removeInstructions(index: Int, count: Int) { - for (i in count downTo 0) { + for (i in count - 1 downTo 0) { this.removeInstruction(index + i) } }