Skip to content

Commit 65396a1

Browse files
committed
Handle non-standard LevelDB chunk data
1 parent a96dda9 commit 65396a1

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

server/src/main/java/org/cloudburstmc/server/level/chunk/BlockStorage.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ public void readFromStorage(ByteBuf buffer) {
194194
this.paletteIndex.put(state, this.palette.size());
195195
this.palette.add(state);
196196
} catch (Exception e) {
197-
log.throwing(e);
197+
log.warn("Failed to deserialize palette entry {}, substituting air", i, e);
198+
this.paletteIndex.put(AIR, this.palette.size());
199+
this.palette.add(AIR);
198200
}
199201
}
200202
} catch (IOException e) {

server/src/main/java/org/cloudburstmc/server/level/provider/leveldb/LevelDBProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public CompletableFuture<CloudChunk> readChunk(ChunkBuilder chunkBuilder) {
8484
| ((finalizationState[1] & 0xFF) << 8)
8585
| ((finalizationState[2] & 0xFF) << 16)
8686
| ((finalizationState[3] & 0xFF) << 24);
87-
chunkBuilder.state(stateValue + 1);
87+
chunkBuilder.state(Math.min(stateValue + 1, Chunk.STATE_FINISHED));
8888
}
8989

9090
byte chunkVersion = versionValue[0];

0 commit comments

Comments
 (0)