Skip corrupt files when importing a legacy cache

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

@ -1243,9 +1243,14 @@ public class CacheImporter @Inject constructor(
}
private fun readFile(store: Store, index: Int, file: Int): File? {
store.read(index, file).use { buf ->
val version = VersionTrailer.strip(buf) ?: return null
return File(index, file, buf.retain(), version)
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
}
}

Loading…
Cancel
Save