diff --git a/app/src/main/java/de/jrpie/android/launcher/Functions.kt b/app/src/main/java/de/jrpie/android/launcher/Functions.kt index 8f5e08d..81e58d7 100644 --- a/app/src/main/java/de/jrpie/android/launcher/Functions.kt +++ b/app/src/main/java/de/jrpie/android/launcher/Functions.kt @@ -93,12 +93,17 @@ fun getUserFromId(userId: Int?, context: Context): UserHandle { fun removeUnusedShortcuts(context: Context) { val launcherApps = context.getSystemService(Service.LAUNCHER_APPS_SERVICE) as LauncherApps fun getShortcuts(profile: UserHandle): List? { - return launcherApps.getShortcuts( - ShortcutQuery().apply { - setQueryFlags(ShortcutQuery.FLAG_MATCH_PINNED) - }, - profile - ) + return try { + launcherApps.getShortcuts( + ShortcutQuery().apply { + setQueryFlags(ShortcutQuery.FLAG_MATCH_PINNED) + }, + profile + ) + } catch (e: IllegalStateException) { + // https://github.com/jrpie/launcher/issues/116 + return null + } } val userManager = context.getSystemService(Service.USER_SERVICE) as UserManager