delete databases more carefully

This commit is contained in:
B. Petersen
2020-04-16 16:40:17 +02:00
parent dfe209610b
commit 4037d6d16f
@@ -170,7 +170,16 @@ public class AccountManager {
sharedPreferences.edit().putString("prev_account_db_name", "").apply();
sharedPreferences.edit().putString("curr_account_db_name", prevDbName).apply();
deleteAccount(context, inCreationDbName);
// delete the previous account, however, as a resilience check, make sure,
// we do not delete already configured accounts (just in case sth. changes the flow of activities)
DcContext testContext = new DcContext(null);
if (testContext.open(new File(context.getFilesDir(), inCreationDbName).getAbsolutePath()) != 0) {
if (testContext.isConfigured() == 0) {
testContext.close();
deleteAccount(context, inCreationDbName);
}
}
resetDcContext(context);
}