From 1e38cd80370edee25732bdccee3d31a29bbda628 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 30 Jul 2018 19:13:39 +0200 Subject: [PATCH] catch and show exceptions thrown at saving contacts --- .../simplemobiletools/contacts/helpers/ContactsHelper.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt index 8d5e4d40..896e8685 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/ContactsHelper.kt @@ -993,7 +993,12 @@ class ContactsHelper(val activity: Activity) { operations.clear() } } - activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations) + + try { + activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations) + } catch (e: Exception) { + activity.showErrorToast(e) + } } fun removeContactsFromGroup(contacts: ArrayList, groupId: Long) {