diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index 533f89f..1fd7698 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -43,14 +43,17 @@ class Patcher( fun addFiles(vararg files: File, throwOnDuplicates: Boolean = false) { for (file in files) { val dexFile = MultiDexIO.readDexFile(true, files[0], NAMER, null, null) + val classes = mutableListOf() for (classDef in dexFile.classes) { - if (cache.classes.any { it.type == classDef.type }) { - // TODO: Use logger and warn about duplicate classes + if (classes.contains(classDef.type)) { if (throwOnDuplicates) throw Exception("Class ${classDef.type} has already been added to the patcher.") + continue } cache.classes.add(classDef) + classes.add(classDef.type) } + classes.clear() } } /**