commit 3bfaa8ad0d6bacce552a13b30d7f9349675a0563 Author: Benjamin Erhart berhart@netzarchitekten.com Date: Thu Apr 30 14:48:13 2020 +0200
Issue #309: Fixed potential crash, when activity went away. --- .../org/torproject/android/ui/onboarding/MoatActivity.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java b/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java index f4e3a107..0565c164 100644 --- a/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java +++ b/app/src/main/java/org/torproject/android/ui/onboarding/MoatActivity.java @@ -419,10 +419,12 @@ public class MoatActivity extends AppCompatActivity implements View.OnClickListe mProgressBar.setVisibility(View.GONE); mBtRequest.setEnabled(mIvCaptcha.getVisibility() == View.VISIBLE);
- new AlertDialog.Builder(this) - .setTitle(R.string.error) - .setMessage(TextUtils.isEmpty(detail) ? exception.getLocalizedMessage() : detail) - .setNegativeButton(R.string.btn_cancel, null) - .show(); + if (!isFinishing()) { + new AlertDialog.Builder(this) + .setTitle(R.string.error) + .setMessage(TextUtils.isEmpty(detail) ? exception.getLocalizedMessage() : detail) + .setNegativeButton(R.string.btn_cancel, null) + .show(); + } } }