From 63b6cede5fa5bcf377ced422da4e861996a41f0d Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 24 Jul 2024 20:00:35 +0200 Subject: [PATCH] fix(SoundCloud - Enable offline sync): Stop crashing by reversing order of patching instructions from last to first to retain indices --- .../patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt b/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt index b6795e4a8..08446f986 100644 --- a/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt +++ b/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt @@ -73,7 +73,7 @@ object EnableOfflineSyncPatch : BytecodePatch( // The first three null checks need to be patched. getInstructions().asSequence().filter { it.opcode == Opcode.IF_EQZ - }.take(3).map { it.location.index }.forEach { nullCheckIndex -> + }.take(3).toList().map { it.location.index }.asReversed().forEach { nullCheckIndex -> val headerStringRegister = getInstruction(nullCheckIndex).registerA addInstruction(nullCheckIndex, "const-string v$headerStringRegister, \"\"")