From 37abd2aa2ecc0f63b98f2cf702b82f605f8e9198 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sat, 7 Aug 2021 13:27:55 -0400 Subject: [PATCH] Fix crash when installing an extension --- .../tachiyomi/extension/util/ExtensionLoader.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index 81644f3336..bd25ee0d88 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -88,11 +88,15 @@ internal object ExtensionLoader { } fun isExtensionInstalledByApp(context: Context, pkgName: String): Boolean { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - context.packageManager.getInstallSourceInfo(pkgName).installingPackageName - } else { - context.packageManager.getInstallerPackageName(pkgName) - } == BuildConfig.APPLICATION_ID + return try { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + context.packageManager.getInstallSourceInfo(pkgName).installingPackageName + } else { + context.packageManager.getInstallerPackageName(pkgName) + } == BuildConfig.APPLICATION_ID + } catch (e: java.lang.Exception) { + false + } } /**