From 11a337865947a6ac74a63ebb3f3f9bc2610f7771 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 29 Aug 2023 04:09:04 +0200 Subject: [PATCH] fix: allow setting `DexClassLoader.optimizedDirectory` This is required for API level below 26, otherwise an NPE is thrown --- src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt b/src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt index 00adc87..b69b140 100644 --- a/src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt +++ b/src/main/kotlin/app/revanced/patcher/PatchBundleLoader.kt @@ -16,6 +16,7 @@ import java.util.jar.JarFile /** * A patch bundle. * + * * @param fromClasses The classes to get [Patch]es from. */ sealed class PatchBundleLoader private constructor( @@ -74,5 +75,8 @@ sealed class PatchBundleLoader private constructor( } .map { classDef -> classDef.type.substring(1, classDef.length - 1) } .map { loadClass(it) } - }) + }) { + @Deprecated("This constructor is deprecated. Use the constructor with the second parameter instead.") + constructor(vararg patchBundles: File) : this(*patchBundles, optimizedDexDirectory = null) + } } \ No newline at end of file