From 32589c88e438e0a1375c256e9bb8a93f5a4d319b Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 13 Jun 2022 01:59:39 +0200 Subject: [PATCH] fix: check if `packageVersion` is compatible with any from `compatiblePackages` --- src/main/kotlin/app/revanced/utils/patcher/Patcher.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt index 51150d23..22692566 100644 --- a/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/utils/patcher/Patcher.kt @@ -36,14 +36,14 @@ fun Patcher.addPatchesFiltered( } if (compatiblePackages == null) println("$prefix: Missing compatibility annotation. Continuing.") - else compatiblePackages.forEach { compatiblePackage -> - if (compatiblePackage.name != packageName) { - println("$prefix: Package name not matching ${compatiblePackage.name}.") + else { + if (!compatiblePackages.any { it.name == packageName }) { + println("$prefix: Incompatible package.") return@patch } - if (!(debugging || compatiblePackage.versions.any { it == packageVersion })) { - println("$prefix: Unsupported version.") + if (!(debugging || compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == packageVersion }})) { + println("$prefix: The package version is $packageVersion and is incompatible.") return@patch } }