Skip to content

Commit 377bb6e

Browse files
committed
fix: restore floating layouts with conflicting names
1 parent e8f10a2 commit 377bb6e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/src/main/java/io/github/sds100/keymapper/backup/BackupManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,13 @@ class BackupManagerImpl(
490490
var entity = layout
491491
var subCount = 0
492492

493-
while (true) {
493+
while (subCount < 1000) {
494494
try {
495-
floatingLayoutRepository.insert(layout)
495+
floatingLayoutRepository.insert(entity)
496496
break
497497
} catch (_: SQLiteConstraintException) {
498498
// If the name already exists try creating it with a new name.
499-
entity = layout.copy(name = "${entity.name} (${subCount + 1})")
499+
entity = layout.copy(name = "${layout.name} (${subCount + 1})")
500500
subCount++
501501
}
502502
}

0 commit comments

Comments
 (0)