fix(SoundCloud - Enable offline sync): Stop crashing by reversing order of patching instructions from last to first to retain indices

This commit is contained in:
oSumAtrIX
2024-07-24 20:00:35 +02:00
parent 8e72067dcb
commit 98f9bba7ed

View File

@@ -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<OneRegisterInstruction>(nullCheckIndex).registerA
addInstruction(nullCheckIndex, "const-string v$headerStringRegister, \"\"")