Skip to content

Commit

Permalink
Fix self-healing for corrupted render-state files, fixes: BlueMap-Min…
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlueF committed Sep 15, 2024
1 parent f25ebfe commit 48fa5b6
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ private synchronized T loadCell(Vector2i pos) {
return BLUE_NBT.read(in.decompress(), type);
} catch (IOException ex) {
Logger.global.logError("Failed to load render-state cell " + pos, ex);
} catch (RuntimeException ex) { // E.g. NoSuchElementException thrown by BlueNBT if there is a format error
Logger.global.logError("Failed to load render-state cell " + pos, ex);

// try to delete the possibly corrupted file for self-healing
try {
storage.delete(pos.getX(), pos.getY());
} catch (IOException e) {
Logger.global.logError("Failed to delete render-state cell " + pos, e);
}
}

return createNewCell();
}

Expand Down

0 comments on commit 48fa5b6

Please sign in to comment.