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 authored and akemin-dayo committed Dec 14, 2024
1 parent e354f43 commit b003ffc
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 b003ffc

Please sign in to comment.