fix: only emit closed patches that did not throw an exception with the @Patch annotation

This commit is contained in:
oSumAtrIX 2023-08-22 19:00:34 +02:00
parent 5c0c0d6c37
commit 5938f6b7ea
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -2,6 +2,7 @@ package app.revanced.patcher
import app.revanced.patcher.data.Context import app.revanced.patcher.data.Context
import app.revanced.patcher.data.ResourceContext 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.dependencies
import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.extensions.PatchExtensions.requiresIntegrations import app.revanced.patcher.extensions.PatchExtensions.requiresIntegrations
@ -202,7 +203,15 @@ class Patcher(
) )
if (returnOnError) return@flow if (returnOnError) return@flow
} ?: emit(result) } ?: run {
executedPatch
.patchInstance::class
.java
.findAnnotationRecursively(app.revanced.patcher.patch.annotations.Patch::class)
?: return@run
emit(result)
}
} }
} }