diff --git a/src/main/kotlin/app/revanced/patcher/signature/MethodSignature.kt b/src/main/kotlin/app/revanced/patcher/signature/MethodSignature.kt index f1a46f87..b349954b 100644 --- a/src/main/kotlin/app/revanced/patcher/signature/MethodSignature.kt +++ b/src/main/kotlin/app/revanced/patcher/signature/MethodSignature.kt @@ -10,13 +10,14 @@ import org.jf.dexlib2.Opcode * @param accessFlags The access flags of the method. * @param methodParameters The parameters of the method. * @param opcodes The list of opcodes of the method. + * A `null` opcode is equals to an unknown opcode. */ class MethodSignature( val metadata: MethodSignatureMetadata, internal val returnType: String?, internal val accessFlags: Int?, internal val methodParameters: Iterable?, - internal val opcodes: Iterable? + internal val opcodes: Iterable? ) { /** * The result of the signature diff --git a/src/main/kotlin/app/revanced/patcher/signature/resolver/SignatureResolver.kt b/src/main/kotlin/app/revanced/patcher/signature/resolver/SignatureResolver.kt index 3d55e845..8183f17b 100644 --- a/src/main/kotlin/app/revanced/patcher/signature/resolver/SignatureResolver.kt +++ b/src/main/kotlin/app/revanced/patcher/signature/resolver/SignatureResolver.kt @@ -93,7 +93,11 @@ internal class SignatureResolver( while (instructionIndex + patternIndex < count) { val originalOpcode = instructions.elementAt(instructionIndex + patternIndex).opcode val patternOpcode = pattern.elementAt(patternIndex) - if (originalOpcode != patternOpcode && currentThreshold-- == 0) break + if ( + patternOpcode != null && // unknown opcode + originalOpcode != patternOpcode && + currentThreshold-- == 0 + ) break if (++patternIndex < size) continue val result = PatternScanResult(instructionIndex, instructionIndex + patternIndex) @@ -125,7 +129,10 @@ internal class SignatureResolver( for ((patternIndex, originalIndex) in (scanResult.startIndex until scanResult.endIndex).withIndex()) { val originalOpcode = instructions.elementAt(originalIndex).opcode val patternOpcode = pattern.elementAt(patternIndex) - if (originalOpcode != patternOpcode) { + if ( + patternOpcode != null && // unknown opcode + originalOpcode != patternOpcode + ) { this.add( PatternScanMethod.Fuzzy.Warning( originalOpcode, patternOpcode,