Skip corrupt files when importing a legacy cache

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent f079c415f5
commit ab964a2b1f
  1. 5
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt

@ -1243,10 +1243,15 @@ public class CacheImporter @Inject constructor(
}
private fun readFile(store: Store, index: Int, file: Int): File? {
try {
store.read(index, file).use { buf ->
val version = VersionTrailer.strip(buf) ?: return null
return File(index, file, buf.retain(), version)
}
} catch (ex: IOException) {
logger.warn(ex) { "Skipping corrupt file (index $index, group $file)" }
return null
}
}
private fun addFiles(connection: Connection, sourceId: Int, files: List<File>) {

Loading…
Cancel
Save