From 5938f6b7ea25103a0a1b56ceebe49139bc80c6f5 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 22 Aug 2023 19:00:34 +0200 Subject: [PATCH] fix: only emit closed patches that did not throw an exception with the `@Patch` annotation --- src/main/kotlin/app/revanced/patcher/Patcher.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index a654c4e..c2e60af 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -2,6 +2,7 @@ package app.revanced.patcher import app.revanced.patcher.data.Context import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.extensions.AnnotationExtensions.findAnnotationRecursively import app.revanced.patcher.extensions.PatchExtensions.dependencies import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.extensions.PatchExtensions.requiresIntegrations @@ -202,7 +203,15 @@ class Patcher( ) if (returnOnError) return@flow - } ?: emit(result) + } ?: run { + executedPatch + .patchInstance::class + .java + .findAnnotationRecursively(app.revanced.patcher.patch.annotations.Patch::class) + ?: return@run + + emit(result) + } } }