Fix app crash when unlocking database V1 without backup folder #692

This commit is contained in:
J-Jamet committed 2020-09-14 12:56:38 +02:00
1 parent 0cb1bf4b7f
commit 2210932fdf
4 files changed
+8 -4

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
KeePassDX(2.8.4)
* Fix incomplete attachment deletion #684
* Fix opening database v1 without backup folder #692
KeePassDX(2.8.3)
* Upload attachments
@@ -60,8 +60,6 @@ class DatabaseKDB : DatabaseVersioned<Int, UUID, GroupKDB, EntryKDB>() {
// Retrieve backup group in index
val backupGroup: GroupKDB?
get() {
if (backupGroupId == BACKUP_FOLDER_UNDEFINED_ID)
ensureBackupExists()
return if (backupGroupId == BACKUP_FOLDER_UNDEFINED_ID)
null
else
@@ -186,6 +184,9 @@ class DatabaseKDB : DatabaseVersioned<Int, UUID, GroupKDB, EntryKDB>() {
override fun isInRecycleBin(group: GroupKDB): Boolean {
var currentGroup: GroupKDB? = group
if (backupGroup == null)
return false
if (currentGroup == backupGroup)
return true
@@ -229,6 +230,8 @@ class DatabaseKDB : DatabaseVersioned<Int, UUID, GroupKDB, EntryKDB>() {
* @return true if node can be recycle, false elsewhere
*/
fun canRecycle(node: NodeVersioned<*, GroupKDB, EntryKDB>): Boolean {
if (backupGroup == null)
ensureBackupExists()
if (node == backupGroup)
return false
backupGroup?.let {
@@ -239,14 +242,12 @@ class DatabaseKDB : DatabaseVersioned<Int, UUID, GroupKDB, EntryKDB>() {
}
fun recycle(group: GroupKDB) {
ensureBackupExists()
removeGroupFrom(group, group.parent)
addGroupTo(group, backupGroup)
group.afterAssignNewParent()
}
fun recycle(entry: EntryKDB) {
ensureBackupExists()
removeEntryFrom(entry, entry.parent)
addEntryTo(entry, backupGroup)
entry.afterAssignNewParent()
@@ -1 +1,2 @@
* Fix incomplete attachment deletion #684
* Fix opening database v1 without backup folder #692
@@ -1 +1,2 @@
* Correction de la suppression incomplète des fichiers joints #684
* Correction de l'ouverture de base de données v1 sans dossier backup #692