diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/os/AppShortcutManager.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/os/AppShortcutManager.kt index e58b34878..8c92b6b3e 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/os/AppShortcutManager.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/os/AppShortcutManager.kt @@ -76,12 +76,18 @@ class AppShortcutManager @Inject constructor( } } - suspend fun requestPinShortcut(manga: Manga): Boolean { - return ShortcutManagerCompat.requestPinShortcut(context, buildShortcutInfo(manga), null) + suspend fun requestPinShortcut(manga: Manga): Boolean = try { + ShortcutManagerCompat.requestPinShortcut(context, buildShortcutInfo(manga), null) + } catch (e: IllegalStateException) { + e.printStackTraceDebug() + false } - suspend fun requestPinShortcut(source: MangaSource): Boolean { - return ShortcutManagerCompat.requestPinShortcut(context, buildShortcutInfo(source), null) + suspend fun requestPinShortcut(source: MangaSource): Boolean = try { + ShortcutManagerCompat.requestPinShortcut(context, buildShortcutInfo(source), null) + } catch (e: IllegalStateException) { + e.printStackTraceDebug() + false } @VisibleForTesting