Catch ActivityNotFoundException when launching a shortcut

This commit is contained in:
MM20 2022-08-05 13:17:46 +02:00
parent 20f6acc389
commit 7a038bd64e
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -1,5 +1,6 @@
package de.mm20.launcher2.search.data
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.content.pm.LauncherApps
@ -47,6 +48,8 @@ class AppShortcut(
launcherApps.startShortcut(launcherShortcut, null, options)
} catch (e: IllegalStateException) {
return false
} catch (e: ActivityNotFoundException) {
return false
}
return true
}