From d8b5880215bad8868ab078736c5f6ea506a8b51c Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 24 Feb 2022 13:20:17 +0530 Subject: [PATCH] Fix Autofill ANR when entry has no TOTP (#1746) --- .../dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt index 2028fedb..051693d2 100644 --- a/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt +++ b/app/src/main/java/dev/msfjarvis/aps/util/autofill/AutofillPreferences.kt @@ -143,6 +143,7 @@ object AutofillPreferences { // Always give priority to a username stored in the encrypted extras val username = entry.username ?: directoryStructure.getUsernameFor(file) ?: context.getDefaultUsername() - return Credentials(username, entry.password, runBlocking { entry.totp.first() }) + val totp = if (entry.hasTotp()) runBlocking { entry.totp.first() } else null + return Credentials(username, entry.password, totp) } }