fix: use instruction index instead of strings list index for StringMatch

This commit is contained in:
oSumAtrIX 2022-09-29 21:27:56 +02:00
parent 9c07ffcc7a
commit 843e62ad29
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -102,17 +102,17 @@ abstract class MethodFingerprint(
val stringsList = methodFingerprint.strings.toMutableList()
implementation.instructions.forEach { instruction ->
if (instruction.opcode.ordinal != Opcode.CONST_STRING.ordinal) return@forEach
implementation.instructions.forEachIndexed { instructionIndex, instruction ->
if (instruction.opcode.ordinal != Opcode.CONST_STRING.ordinal) return@forEachIndexed
val string = ((instruction as ReferenceInstruction).reference as StringReference).string
val index = stringsList.indexOfFirst { it == string }
if (index == -1) return@forEach
if (index == -1) return@forEachIndexed
add(
StringMatch(
string,
index
instructionIndex
)
)
stringsList.removeAt(index)