From 0f1473ab8054edad51dbcd04d52ae55abc71f37f Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 11 May 2024 21:52:46 +0900 Subject: [PATCH] fix(YouTube): `Ambient mode control` patch does not work correctly on certain versions --- .../youtube/player/ambientmode/AmbientModeSwitchPatch.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/ambientmode/AmbientModeSwitchPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/ambientmode/AmbientModeSwitchPatch.kt index 3c01f99fd..e0628976a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/ambientmode/AmbientModeSwitchPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/ambientmode/AmbientModeSwitchPatch.kt @@ -61,7 +61,8 @@ object AmbientModeSwitchPatch : BaseBytecodePatch( context.findClass(className)?.mutableClass?.methods?.first { method -> method.name == "accept" }?.apply { - for ((index, instruction) in implementation!!.instructions.withIndex()) { + for (index in implementation!!.instructions.size - 1 downTo 0) { + val instruction = getInstruction(index) if (instruction.opcode != Opcode.INVOKE_VIRTUAL) continue