Prevent crash

pull/212/head
M66B 2 years ago
parent a805c2a7e8
commit 02a215e4e7

@ -188,14 +188,12 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
window.setNavigationBarColor(colorPrimaryDark); window.setNavigationBarColor(colorPrimaryDark);
} }
Fragment bfragment = getSupportFragmentManager() FragmentManager fm = getSupportFragmentManager();
.findFragmentByTag("androidx.biometric.BiometricFragment");
Fragment bfragment = fm.findFragmentByTag("androidx.biometric.BiometricFragment");
if (bfragment != null) { if (bfragment != null) {
Log.e("Orphan BiometricFragment"); Log.e("Orphan BiometricFragment");
getSupportFragmentManager() fm.beginTransaction().remove(bfragment).commitNowAllowingStateLoss();
.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 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) 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); checkAuthentication(true);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

Loading…
Cancel
Save