From 6482b31971f09b7086809fd4aa5c96f8611e9840 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Wed, 21 Aug 2019 14:40:38 -0500 Subject: [PATCH] Avoid crash in TransferDetailsAdapter. - This is the adapter that populates the list of transactions in the TransactionsFragment, the crash was happening when the user tapped two or more items in the list at the same time. When that happens only the first item tapped opens its corresponding eReceipt correctly but the remaining ones throw an excpeption which was not being handled correctly and causing a crash. --- .../adapters/TransfersDetailsAdapter.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt index 34a9645..93f26d5 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt @@ -1,6 +1,7 @@ package cy.agorise.bitsybitshareswallet.adapters import android.content.Context +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -158,7 +159,14 @@ class TransfersDetailsAdapter(private val context: Context) : // Open the eReceipt when a transaction is tapped viewHolder.rootView.setOnClickListener { v -> val action = TransactionsFragmentDirections.eReceiptAction(transferDetail.id) - v.findNavController().navigate(action) + try { + v.findNavController().navigate(action) + } catch (ignored: IllegalArgumentException) { + // This exception is being ignored because it happens when a user taps two or + // more items on the list at the same time, only the first navigates correctly and + // the remaining produce an exception. + Log.d("TransfersDetailsAdapter", "Ignoring IllegalArgumentException") + } } }