[3.2.0][应用升级] 优化代码逻辑,捕获相关异常

This commit is contained in:
renwj
2023-05-24 17:54:04 +08:00
parent 457dadde17
commit f3342cbb97
2 changed files with 12 additions and 4 deletions

View File

@@ -60,8 +60,12 @@ class ApkInstaller {
@JvmStatic
fun isInstallAppStore(ctx: Context): Boolean {
val installedPackages = ctx.packageManager.getInstalledPackages(0)
return installedPackages.find { it.packageName == "com.mogo.appstore" } != null
return try {
val installedPackages = ctx.packageManager.getInstalledPackages(0)
installedPackages.find { it.packageName == "com.mogo.appstore" } != null
} catch (t: Throwable) {
false
}
}
}
}