From 6db44dfab1a9f504f6bfa430ed218556bb8fe23b Mon Sep 17 00:00:00 2001 From: m2049r Date: Wed, 21 Apr 2021 19:54:20 +0200 Subject: [PATCH] cleanup backup code (#753) --- app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index 75db7c5..1a660d6 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -474,6 +474,7 @@ public class LoginActivity extends BaseActivity @Override public void onWalletBackup(String walletName) { Timber.d("backup for wallet ." + walletName + "."); + // overwrite any pending backup request zipBackup = new ZipBackup(this, walletName); Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); @@ -500,14 +501,18 @@ public class LoginActivity extends BaseActivity if (data == null) { // nothing selected Toast.makeText(this, getString(R.string.backup_failed), Toast.LENGTH_LONG).show(); + zipBackup = null; return; } try { + if (zipBackup == null) return; // ignore unsolicited request zipBackup.writeTo(data.getData()); Toast.makeText(this, getString(R.string.backup_success), Toast.LENGTH_SHORT).show(); } catch (IOException ex) { Timber.e(ex); Toast.makeText(this, getString(R.string.backup_failed), Toast.LENGTH_LONG).show(); + } finally { + zipBackup = null; } } else if (requestCode == RESTORE_BACKUP_INTENT) { if (data == null) {