mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-21 06:19:12 +00:00
Prevent a crash caused by adding the same entry to the vault twice
This could happen in rare cases where writing the vault to disk failed.
This commit is contained in:
parent
7d38bc9b71
commit
d43e5e04c7
1 changed files with 5 additions and 1 deletions
|
@ -452,7 +452,11 @@ public class EditEntryActivity extends AegisActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAndFinish(VaultEntry entry) {
|
private void addAndFinish(VaultEntry entry) {
|
||||||
if (_isNew) {
|
// It's possible that the new entry was already added to the vault, but writing the
|
||||||
|
// vault to disk failed, causing the user to tap 'Save' again. Calling addEntry
|
||||||
|
// again would cause a crash in that case, so the isEntryDuplicate check prevents
|
||||||
|
// that.
|
||||||
|
if (_isNew && !_vault.isEntryDuplicate(entry)) {
|
||||||
_vault.addEntry(entry);
|
_vault.addEntry(entry);
|
||||||
} else {
|
} else {
|
||||||
_vault.replaceEntry(entry);
|
_vault.replaceEntry(entry);
|
||||||
|
|
Loading…
Add table
Reference in a new issue