From 5146de872acb17d7c21019ac7ed531f27361038f Mon Sep 17 00:00:00 2001 From: Oyssale <40800924+Oyssale@users.noreply.github.com> Date: Sun, 24 Sep 2023 17:07:10 +0200 Subject: [PATCH] fix(Duolingo - Unlock Super): Get correct instruction offset (#3023) --- .../patches/duolingo/unlocksuper/UnlockDuolingoSuperPatch.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/duolingo/unlocksuper/UnlockDuolingoSuperPatch.kt b/src/main/kotlin/app/revanced/patches/duolingo/unlocksuper/UnlockDuolingoSuperPatch.kt index 3dcd37cb..532f3902 100644 --- a/src/main/kotlin/app/revanced/patches/duolingo/unlocksuper/UnlockDuolingoSuperPatch.kt +++ b/src/main/kotlin/app/revanced/patches/duolingo/unlocksuper/UnlockDuolingoSuperPatch.kt @@ -54,8 +54,8 @@ object UnlockDuolingoSuperPatch : BytecodePatch( } private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions() - .filterIsInstance() - .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 }