From 188014ceb81a977db5fcc9d01964025d56e3258a Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 18 May 2021 15:45:04 +0200 Subject: [PATCH] adding a crashfix at viewing contact details --- .../contacts/pro/activities/ViewContactActivity.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt index e33a82df..c9f4d43a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt @@ -638,12 +638,14 @@ class ViewContactActivity : ContactActivity() { ensureBackgroundThread { val actions = getSocialActions(contactId) runOnUiThread { - ChooseSocialDialog(this@ViewContactActivity, actions) { action -> - Intent(Intent.ACTION_VIEW).apply { - val uri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, action.dataId) - setDataAndType(uri, action.mimetype) - flags = Intent.FLAG_ACTIVITY_CLEAR_TASK - startActivity(this) + if (!isDestroyed && !isFinishing) { + ChooseSocialDialog(this@ViewContactActivity, actions) { action -> + Intent(Intent.ACTION_VIEW).apply { + val uri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, action.dataId) + setDataAndType(uri, action.mimetype) + flags = Intent.FLAG_ACTIVITY_CLEAR_TASK + startActivity(this) + } } } }