From a315de3af8a4dd27ace7e8ee87fea64539bb3639 Mon Sep 17 00:00:00 2001 From: M3DZIK Date: Sat, 2 Mar 2024 13:12:51 +0100 Subject: [PATCH] Fix crashing when biometric unlocking failed --- .../dev/medzik/librepass/android/ui/screens/auth/Unlock.kt | 3 +++ .../dev/medzik/librepass/android/ui/screens/vault/Vault.kt | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/dev/medzik/librepass/android/ui/screens/auth/Unlock.kt b/app/src/main/java/dev/medzik/librepass/android/ui/screens/auth/Unlock.kt index e2a8bd60..997872e7 100644 --- a/app/src/main/java/dev/medzik/librepass/android/ui/screens/auth/Unlock.kt +++ b/app/src/main/java/dev/medzik/librepass/android/ui/screens/auth/Unlock.kt @@ -36,6 +36,7 @@ import dev.medzik.librepass.android.utils.KeyAlias import dev.medzik.librepass.android.utils.checkIfBiometricAvailable import dev.medzik.librepass.android.utils.debugLog import dev.medzik.librepass.android.utils.showBiometricPromptForUnlock +import dev.medzik.librepass.android.utils.showErrorToast import dev.medzik.librepass.utils.Cryptography.computeAesKey import dev.medzik.librepass.utils.Cryptography.computePasswordHash import kotlinx.coroutines.Dispatchers @@ -140,6 +141,8 @@ fun UnlockScreen( } catch (e: Exception) { e.debugLog() } + } catch (e: Exception) { + e.showErrorToast(context) } } diff --git a/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt b/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt index 6859cb01..b9244980 100644 --- a/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt +++ b/app/src/main/java/dev/medzik/librepass/android/ui/screens/vault/Vault.kt @@ -150,7 +150,11 @@ fun VaultScreen( LaunchedEffect(scope) { if (credentials.biometricReSetup) { - reSetupBiometrics() + try { + reSetupBiometrics() + } catch (e: Exception) { + e.showErrorToast(context) + } } // get local stored ciphers