Prevent crash

This commit is contained in:
M66B 2023-02-16 21:13:56 +01:00
parent a805c2a7e8
commit 02a215e4e7
1 changed files with 10 additions and 6 deletions

View File

@ -188,14 +188,12 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
window.setNavigationBarColor(colorPrimaryDark);
}
Fragment bfragment = getSupportFragmentManager()
.findFragmentByTag("androidx.biometric.BiometricFragment");
FragmentManager fm = getSupportFragmentManager();
Fragment bfragment = fm.findFragmentByTag("androidx.biometric.BiometricFragment");
if (bfragment != null) {
Log.e("Orphan BiometricFragment");
getSupportFragmentManager()
.beginTransaction()
.remove(bfragment)
.commitNowAllowingStateLoss();
fm.beginTransaction().remove(bfragment).commitNowAllowingStateLoss();
/*
java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.faircode.email/eu.faircode.email.ActivitySetup}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment androidx.biometric.FingerprintDialogFragment: could not find Fragment constructor
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957)
@ -233,6 +231,12 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
*/
}
Fragment ffragment = fm.findFragmentByTag("androidx.biometric.FingerprintDialogFragment");
if (ffragment != null) {
Log.e("Orphan FingerprintDialogFragment");
fm.beginTransaction().remove(ffragment).commitNowAllowingStateLoss();
}
checkAuthentication(true);
super.onCreate(savedInstanceState);