From d14c10c672634ff1d4a805753634f0bdf35b84fa Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Wed, 30 Oct 2019 18:19:36 -0600 Subject: [PATCH] Avoid crash in SendTransactionFragment. - The crash was happening because the dialog that verifies the automatic time was being created in onResume, so if the user leaved the application while the fragment was showing and returned to it later another multiple dialogs would be created. The first one to be accepted correctly navigates the user back, but the second creates a crash because references a no longer existing fragment. The dialog creation was moved to onViewCreated instead, so that only one dialog is created. --- .../fragments/SendTransactionFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt index ed2f90e..48c1b63 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt @@ -221,6 +221,8 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand populatePropertiesFromQRCodeString(Invoice.toQrCode(invoice)) }, 2000) // Wait to let the other elements of the fragment initialize } + + verifyGlobalSettingsTimeAutomatic() } /** Handles the selection of items in the Asset spinner, to keep track of the selectedAssetSymbol and show the @@ -592,7 +594,7 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand title(R.string.title__time_sync_error) message(R.string.msg__time_sync_error) positiveButton(android.R.string.ok) { - this@SendTransactionFragment.findNavController().navigateUp() + findNavController().navigateUp() } cancelable(false) cancelOnTouchOutside(false) @@ -639,8 +641,6 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand if (isCameraPreviewVisible) startCameraPreview() - - verifyGlobalSettingsTimeAutomatic() } override fun onPause() {