fix: SignatureChecker not handling nullable field methodMetadata

This commit is contained in:
oSumAtrIX 2022-04-18 17:16:28 +02:00
parent 736a71fac2
commit 17bcf786a8
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -1,6 +1,7 @@
package app.revanced.patches package app.revanced.patches
import app.revanced.patcher.Patcher import app.revanced.patcher.Patcher
import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.signature.MethodSignature
import app.revanced.patcher.signature.PatternScanMethod import app.revanced.patcher.signature.PatternScanMethod
import org.jf.dexlib2.iface.Method import org.jf.dexlib2.iface.Method
@ -27,7 +28,8 @@ internal class SignatureChecker {
if (patternScanMethod is PatternScanMethod.Fuzzy) { if (patternScanMethod is PatternScanMethod.Fuzzy) {
val warnings = patternScanMethod.warnings!! val warnings = patternScanMethod.warnings!!
val method = signature.result!!.method 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()}") println("Signature: ${signature.metadata.name}.\nMethod: ${methodFromMetadata.definingClass}->${methodFromMetadata.name} (Signature matches: ${method.definingClass}->${method.toStr()})\nWarnings: ${warnings.count()}")
for (warning in warnings) { for (warning in warnings) {
println("${warning.instructionIndex} / ${warning.patternIndex}: ${warning.wrongOpcode} (expected: ${warning.correctOpcode})") println("${warning.instructionIndex} / ${warning.patternIndex}: ${warning.wrongOpcode} (expected: ${warning.correctOpcode})")