From 17bcf786a85ccf1f7d9f5a66a044a3c26def09bb Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 18 Apr 2022 17:16:28 +0200 Subject: [PATCH] fix: `SignatureChecker` not handling nullable field `methodMetadata` --- src/test/kotlin/app/revanced/patches/SignatureChecker.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/app/revanced/patches/SignatureChecker.kt b/src/test/kotlin/app/revanced/patches/SignatureChecker.kt index 2e221c09b..67d6de8b4 100644 --- a/src/test/kotlin/app/revanced/patches/SignatureChecker.kt +++ b/src/test/kotlin/app/revanced/patches/SignatureChecker.kt @@ -1,6 +1,7 @@ package app.revanced.patches import app.revanced.patcher.Patcher +import app.revanced.patcher.signature.MethodMetadata import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.signature.PatternScanMethod import org.jf.dexlib2.iface.Method @@ -27,7 +28,8 @@ internal class SignatureChecker { if (patternScanMethod is PatternScanMethod.Fuzzy) { val warnings = patternScanMethod.warnings!! val method = signature.result!!.method - val methodFromMetadata = signature.metadata.methodMetadata + val methodFromMetadata = if (signature.metadata.methodMetadata != null) signature.metadata.methodMetadata!! else MethodMetadata(null, null) + println("Signature: ${signature.metadata.name}.\nMethod: ${methodFromMetadata.definingClass}->${methodFromMetadata.name} (Signature matches: ${method.definingClass}->${method.toStr()})\nWarnings: ${warnings.count()}") for (warning in warnings) { println("${warning.instructionIndex} / ${warning.patternIndex}: ${warning.wrongOpcode} (expected: ${warning.correctOpcode})")