fix(Duolingo - Unlock Super): Get correct instruction offset (#3023)

This commit is contained in:
Oyssale 2023-09-24 17:07:10 +02:00 committed by GitHub
parent 0e0b73521c
commit 5146de872a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,8 +54,8 @@ object UnlockDuolingoSuperPatch : BytecodePatch(
}
private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions()
.filterIsInstance<BuilderInstruction22c>()
.filter { it.opcode == Opcode.IPUT_BOOLEAN }.indexOfFirst { it.reference == reference }.let {
.indexOfFirst { it is BuilderInstruction22c && it.opcode == Opcode.IPUT_BOOLEAN && it.reference == reference }
.let {
if (it == -1) throw PatchException("Could not find index of instruction with supplied reference.")
else it
}