Don't initialize VaultManager after the intro unless saving succeeds

In rare cases where writing to disk fails after the intro, a crash could
occur if the user presses "Done" again. VaultManager would have been
initialized, and trying to initialize it again would result in a crash.
This commit is contained in:
Alexander Bakker 2024-03-10 19:50:17 +01:00
parent 2d0e201060
commit 8bbbe3611a

View file

@ -55,8 +55,9 @@ public class VaultManager {
throw new IllegalStateException("Vault manager is already initialized");
}
_repo = new VaultRepository(_context, new Vault(), creds);
save();
VaultRepository repo = new VaultRepository(_context, new Vault(), creds);
repo.save();
_repo = repo;
if (getVault().isEncryptionEnabled()) {
startNotificationService();