only attempt to remove empty terrain file if it exists

This commit is contained in:
crabman 2024-04-03 18:32:22 +01:00
parent 5e8de39fd0
commit 59b176a7bb
No known key found for this signature in database

View File

@ -169,8 +169,10 @@ impl TerrainPersistence {
if chunk.blocks.is_empty() {
let path = self.path_for(key);
if let Err(error) = std::fs::remove_file(&path) {
error!(?error, ?path, "Failed to remove file for empty chunk");
if path.is_file() {
if let Err(error) = std::fs::remove_file(&path) {
error!(?error, ?path, "Failed to remove file for empty chunk");
}
}
} else {
let bytes = match bincode::serialize::<version::Current>(&chunk.prepare_raw()) {