From 81c4960dd68d8e127aa3e7d5e0acd932fef9765e Mon Sep 17 00:00:00 2001 From: Fabian Henneke Date: Sat, 30 May 2020 21:55:14 +0200 Subject: Fix GitAsyncTask activity handling in error case (#818) --- app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app/src/main/java/com') diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.kt index 631bbf88..0b4caadf 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.kt @@ -131,6 +131,10 @@ class GitAsyncTask( is Result.Err -> { e(result.err) operation.onError(rootCauseException(result.err)) + if (finishWithResultOnEnd != null) { + activity?.setResult(Activity.RESULT_CANCELED) + activity?.finish() + } } is Result.Ok -> { operation.onSuccess() @@ -138,11 +142,11 @@ class GitAsyncTask( activity?.setResult(Activity.RESULT_OK, finishWithResultOnEnd) activity?.finish() } - if (refreshListOnEnd) { - (activity as? PasswordStore)?.resetPasswordList() - } } } + if (refreshListOnEnd) { + (activity as? PasswordStore)?.resetPasswordList() + } } } -- cgit v1.2.3