diff options
author | Fabian Henneke <FabianHenneke@users.noreply.github.com> | 2020-04-15 17:43:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 21:13:31 +0530 |
commit | db2743289d9f4423bee5a6d357c4c73c566db9d2 (patch) | |
tree | e044bf19ee111e3570412e295ca89d18eab9117d /app/src/main/java/com/zeapo | |
parent | 75a70543b3def38d3e89fce489c2c99c1bb45d5f (diff) |
Fix crash on Autofill save introduced by #699 (#706)
Diffstat (limited to 'app/src/main/java/com/zeapo')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt index c3132a79..9da575fd 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt @@ -120,23 +120,29 @@ class AutofillSaveActivity : Activity() { AutofillMatcher.addMatchFor(this, it, File(createdPath)) } val longName = data.getStringExtra("LONG_NAME")!! - val password = data.getStringExtra("PASSWORD")!! - val username = data.getStringExtra("USERNAME") - val clientState = - intent?.getBundleExtra(AutofillManager.EXTRA_CLIENT_STATE) ?: run { - e { "AutofillDecryptActivity started without EXTRA_CLIENT_STATE" } - finish() - return + val password = data.getStringExtra("PASSWORD") + val result = if (password != null) { + // Password was generated and should be filled into a form. + val username = data.getStringExtra("USERNAME") + val clientState = + intent?.getBundleExtra(AutofillManager.EXTRA_CLIENT_STATE) ?: run { + e { "AutofillDecryptActivity started without EXTRA_CLIENT_STATE" } + finish() + return + } + val credentials = Credentials(username, password) + val fillInDataset = FillableForm.makeFillInDataset( + this, + credentials, + clientState, + AutofillAction.Generate + ) + Intent().apply { + putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) } - val credentials = Credentials(username, password) - val fillInDataset = FillableForm.makeFillInDataset( - this, - credentials, - clientState, - AutofillAction.Generate - ) - val result = Intent().apply { - putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset) + } else { + // Password was extracted from a form, there is nothing to fill. + Intent() } // PgpActivity delegates committing the added file to PasswordStore. Since PasswordStore // is not involved in an AutofillScenario, we have to commit the file ourselves. |