diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DatabaseMigration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DatabaseMigration.kt index fc70371d8..ee2d32f9f 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DatabaseMigration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DatabaseMigration.kt @@ -22,14 +22,18 @@ class DatabaseMigration( @ExperimentalPathApi @PostConstruct fun init() { - convertHomeDir(komgaProperties.database.file).parent.listDirectoryEntries("*.mv.db*").let { h2Files -> - if (h2Files.isNotEmpty()) { - logger.info { "Deleting old H2 database files" } - h2Files.forEach { - logger.info { "Delete: $it" } - it.deleteIfExists() + try { + convertHomeDir(komgaProperties.database.file).parent?.listDirectoryEntries("*.mv.db*")?.let { h2Files -> + if (h2Files.isNotEmpty()) { + logger.info { "Deleting old H2 database files" } + h2Files.forEach { + logger.info { "Delete: $it" } + it.deleteIfExists() + } } } + } catch (e: Exception) { + logger.warn(e) { "Could not delete old H2 database files" } } } }