From 4b3051a845ddcf58b5f5700bb83badab24a7939d Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 19 Apr 2020 20:41:12 +0200 Subject: [PATCH] catch and show exceptions thrown at sending messages --- .../smsmessenger/activities/ThreadActivity.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index f5a03c70..f713ca91 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -432,12 +432,16 @@ class ThreadActivity : SimpleActivity() { } } - transaction.sendNewMessage(message, threadId.toLong()) + try { + transaction.sendNewMessage(message, threadId.toLong()) - thread_type_message.setText("") - attachmentUris.clear() - thread_attachments_holder.beGone() - thread_attachments_wrapper.removeAllViews() + thread_type_message.setText("") + attachmentUris.clear() + thread_attachments_holder.beGone() + thread_attachments_wrapper.removeAllViews() + } catch (e: Exception) { + showErrorToast(e) + } } // show selected contacts, properly split to new lines when appropriate