Skip to content

Commit

Permalink
fix: remove unnecessary dummy nop instructions (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
MewtR authored Nov 14, 2022
1 parent d2f91a8 commit f9bc95f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9bc95f

Please sign in to comment.