fix: npe when patching on android 8

This commit is contained in:
Ushie 2023-09-03 20:54:42 +03:00
parent c5fc54e721
commit 9f64011b26
No known key found for this signature in database
GPG Key ID: B3AAD18842E34632

View File

@ -24,7 +24,6 @@ import java.io.StringWriter
import java.util.logging.LogRecord import java.util.logging.LogRecord
import java.util.logging.Logger import java.util.logging.Logger
class MainActivity : FlutterActivity() { class MainActivity : FlutterActivity() {
private val handler = Handler(Looper.getMainLooper()) private val handler = Handler(Looper.getMainLooper())
private lateinit var installerChannel: MethodChannel private lateinit var installerChannel: MethodChannel
@ -182,7 +181,8 @@ class MainActivity : FlutterActivity() {
updateProgress(0.1, "Loading patches...", "Loading patches") updateProgress(0.1, "Loading patches...", "Loading patches")
val patches = PatchBundleLoader.Dex( val patches = PatchBundleLoader.Dex(
File(patchBundleFilePath) File(patchBundleFilePath),
optimizedDexDirectory = cacheDir
).filter { patch -> ).filter { patch ->
val isCompatible = patch.compatiblePackages?.any { val isCompatible = patch.compatiblePackages?.any {
it.name == patcher.context.packageMetadata.packageName it.name == patcher.context.packageMetadata.packageName