From d23a85476b3d60b8acc4eba5c3b8d407773d033b Mon Sep 17 00:00:00 2001 From: Sumit Pundir Date: Fri, 6 Mar 2020 17:00:09 +0530 Subject: [PATCH] presentation: handle "vcard.formattedName must not be null" exception fixes https://gitlab.e.foundation/e/management/issues/1015 --- .../java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt | 5 +++-- .../java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt index a158a3951..82b910403 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/AttachmentAdapter.kt @@ -19,6 +19,7 @@ package com.moez.QKSMS.feature.compose import android.content.Context +import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup import com.bumptech.glide.Glide @@ -80,7 +81,7 @@ class AttachmentAdapter @Inject constructor( .mapNotNull { vCard -> Ezvcard.parse(vCard).first() } .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe { vcard -> view.name?.text = vcard.formattedName.value } + .subscribe( { vcard -> view.name?.text = vcard.formattedName.value }, { throwable -> Log.i("AttachmentAdapter.kt", "Name field is null") } ) } } @@ -89,4 +90,4 @@ class AttachmentAdapter @Inject constructor( is Attachment.Contact -> VIEW_TYPE_CONTACT } -} \ No newline at end of file +} diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt index 205437d4e..294f23c79 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt @@ -19,6 +19,7 @@ package com.moez.QKSMS.feature.compose.part import android.content.Context +import android.util.Log import android.view.Gravity import android.view.View import android.widget.FrameLayout @@ -63,7 +64,7 @@ class VCardBinder @Inject constructor(colors: Colors, private val context: Conte .mapNotNull { inputStream -> inputStream.use { Ezvcard.parse(it).first() } } .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe { vcard -> view.name?.text = vcard.formattedName.value } + .subscribe( { vcard -> view.name?.text = vcard.formattedName.value }, { throwable -> Log.i("VCardBinder.kt", "Name field is null") } ) val params = view.vCardBackground.layoutParams as FrameLayout.LayoutParams if (!message.isMe()) { @@ -81,4 +82,4 @@ class VCardBinder @Inject constructor(colors: Colors, private val context: Conte } } -} \ No newline at end of file +} -- GitLab