From f9bc95f220aa434308ce6950ba6ad2e7efac9c8a Mon Sep 17 00:00:00 2001 From: MewtR Date: Mon, 14 Nov 2022 10:57:13 -0500 Subject: [PATCH] fix: remove unnecessary dummy nop instructions (#111) --- src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt index 9f1b8e2..67e3555 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt @@ -139,10 +139,10 @@ fun MutableMethod.addInstructions(index: Int, smali: String, externalLabels: Lis // Add the compiled list of instructions to the method. val methodImplementation = this.implementation!! - methodImplementation.addInstructions(index, compiledInstructions) + methodImplementation.addInstructions(index, compiledInstructions.subList(0, compiledInstructions.size - externalLabels.size)) val methodInstructions = methodImplementation.instructions - methodInstructions.subList(index, index + compiledInstructions.size) + methodInstructions.subList(index, index + compiledInstructions.size - externalLabels.size) .forEachIndexed { compiledInstructionIndex, compiledInstruction -> // If the compiled instruction is not an offset instruction, skip it. if (compiledInstruction !is BuilderOffsetInstruction) return@forEachIndexed