From a65916c54e54c97d960ef74fd8cb4515e410145c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Nov 2022 20:31:03 +0100 Subject: [PATCH] catch and show exceptions thrown at sending a message --- .../com/simplemobiletools/smsmessenger/helpers/Messaging.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Messaging.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Messaging.kt index 6935744d..e4e2ce63 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Messaging.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/helpers/Messaging.kt @@ -72,7 +72,11 @@ fun Context.sendMessage(text: String, addresses: List, subscriptionId: I transaction.setExplicitBroadcastForSentSms(smsSentIntent) transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent) Handler(Looper.getMainLooper()).post { - transaction.sendNewMessage(message) + try { + transaction.sendNewMessage(message) + } catch (e: Exception) { + showErrorToast(e) + } } }