diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/screenshotpopup/ScreenshotPopupPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/screenshotpopup/ScreenshotPopupPatch.kt index 4c4653142..096fa09be 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/screenshotpopup/ScreenshotPopupPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/screenshotpopup/ScreenshotPopupPatch.kt @@ -2,6 +2,7 @@ package app.revanced.patches.reddit.layout.screenshotpopup import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction +import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.bytecodePatch import app.revanced.patches.reddit.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.reddit.utils.extension.Constants.PATCHES_PATH @@ -57,6 +58,8 @@ val screenshotPopupPatch = bytecodePatch( indexOfSetValueInstruction(this) >= 0 } + var hookCount = 0 + classes.forEach { classDef -> classDef.methods.forEach { method -> if (method.isScreenShotMethod()) { @@ -75,11 +78,16 @@ val screenshotPopupPatch = bytecodePatch( move-result-object v$booleanRegister """ ) + hookCount++ } } } } + if (hookCount == 0) { + throw PatchException("Failed to find hook method") + } + updatePatchStatus( "enableScreenshotPopup", DISABLE_SCREENSHOT_POPUP