Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d0d81e6 authored by tibbi's avatar tibbi
Browse files

catch exceptions thrown at showing otasts

parent 9ae8bafa
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -56,13 +56,16 @@ fun Activity.toast(msg: String, length: Int = Toast.LENGTH_SHORT) {

private fun showToast(activity: Activity, messageId: Int, length: Int) {
    if (!activity.isActivityDestroyed()) {
        Toast.makeText(activity.applicationContext, messageId, length).show()
        showToast(activity, activity.getString(messageId), length)
    }
}

private fun showToast(activity: Activity, message: String, length: Int) {
    if (!activity.isActivityDestroyed()) {
        try {
            Toast.makeText(activity.applicationContext, message, length).show()
        } catch (e: Exception) {
        }
    }
}