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.
pull/1295/head
Alexander Bakker 12 months ago
parent 2d0e201060
commit 8bbbe3611a

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

Loading…
Cancel
Save