From b2f10454db86f695c709aa86203cbafa14ea2da5 Mon Sep 17 00:00:00 2001 From: Corewala Date: Wed, 18 May 2022 18:50:56 -0400 Subject: [PATCH] Fixed null pointer error --- .../main/java/corewala/buran/ui/settings/SettingsFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/corewala/buran/ui/settings/SettingsFragment.kt b/app/src/main/java/corewala/buran/ui/settings/SettingsFragment.kt index b420f1e..c408723 100644 --- a/app/src/main/java/corewala/buran/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/corewala/buran/ui/settings/SettingsFragment.kt @@ -273,7 +273,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang clientCertPassword.key = Buran.PREF_KEY_CLIENT_CERT_PASSWORD clientCertPassword.title = getString(R.string.client_certificate_password) - val certPassword = preferenceManager.sharedPreferences.getString( + var certPassword = preferenceManager.sharedPreferences.getString( Buran.PREF_KEY_CLIENT_CERT_PASSWORD, null ) @@ -327,6 +327,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang println("Authentication succeeded") if(newValue as Boolean){ + println(certPassword) val encryptedData = biometricManager.encryptData(certPassword!!, result.cryptoObject?.cipher!!) val ciphertext = encryptedData.ciphertext val initializationVector = encryptedData.initializationVector @@ -364,6 +365,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang clientCertPassword.summary = getDots(passphrase) useBiometrics.isVisible = true } + certPassword = passphrase true//update the value } }