Fix crashes when an uninstalled app is pinned to favorites
This commit is contained in:
parent
3a15b59526
commit
ce7ac0759a
@ -3,6 +3,7 @@ package de.mm20.launcher2.search.data
|
|||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
@ -43,8 +44,12 @@ abstract class Application(
|
|||||||
|
|
||||||
open fun getStoreDetails(context: Context): StoreLink? {
|
open fun getStoreDetails(context: Context): StoreLink? {
|
||||||
val pm = context.packageManager
|
val pm = context.packageManager
|
||||||
val installSourceInfo = PackageManagerCompat.getInstallSource(pm, `package`)
|
return try {
|
||||||
return getStoreLinkForInstaller(installSourceInfo.initiatingPackageName, `package`)
|
val installSourceInfo = PackageManagerCompat.getInstallSource(pm, `package`)
|
||||||
|
getStoreLinkForInstaller(installSourceInfo.initiatingPackageName, `package`)
|
||||||
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val key: String
|
override val key: String
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user