From de2391c6f8accc42da451483e0783e83ff06e435 Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Sat, 15 Sep 2018 21:25:41 -0400 Subject: [PATCH] - Put the loading dialog code of the backup restore before the import request is added - Fixing an error triggered when the import seed form is filled too fast. The bitshare name request of the account gets a null listener and makes the app to crash --- .../fragments/ImportAccountOptionsFragment.java | 8 ++++---- .../requestmanagers/CryptoNetInfoRequest.java | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java index 6d3fe60..259e0ad 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ImportAccountOptionsFragment.java @@ -196,15 +196,15 @@ public class ImportAccountOptionsFragment extends DialogFragment { } }); - FileServiceRequests.getInstance().addRequest(importBackupRequest); - /* - * Show loading dialog - * */ + * Show loading dialog + * */ crystalDialog = new CrystalDialog((Activity) getContext()); crystalDialog.setText(getContext().getString(R.string.Creating_backup_from_file)); crystalDialog.progress(); crystalDialog.show(); + + FileServiceRequests.getInstance().addRequest(importBackupRequest); } }) .setNegativeButton("Cancel", diff --git a/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetInfoRequest.java b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetInfoRequest.java index bdeecbc..f45a5b1 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetInfoRequest.java +++ b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/CryptoNetInfoRequest.java @@ -37,7 +37,9 @@ public abstract class CryptoNetInfoRequest { } protected void _fireOnCarryOutEvent(){ - listener.onCarryOut(); + if (listener != null) { + listener.onCarryOut(); + } CryptoNetInfoRequests.getInstance().removeRequest(this); }