Skip to content

Commit c9d57aa

Browse files
Fix possible NPE in 1.17->1.16.4 bedrock at 0 emulation (#821)
1 parent 7e08534 commit c9d57aa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_17to1_16_4/rewriter/BlockItemPacketRewriter1_17.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,12 @@ public void register() {
364364

365365
if (ViaBackwards.getConfig().bedrockAtY0()) {
366366
final ChunkSection lowestSection = chunk.getSections()[0];
367-
final DataPalette blocks = lowestSection.palette(PaletteType.BLOCKS);
368-
for (int x = 0; x < 16; x++) {
369-
for (int z = 0; z < 16; z++) {
370-
blocks.setIdAt(x, 0, z, BEDROCK_BLOCK_STATE);
367+
if (lowestSection != null) {
368+
final DataPalette blocks = lowestSection.palette(PaletteType.BLOCKS);
369+
for (int x = 0; x < 16; x++) {
370+
for (int z = 0; z < 16; z++) {
371+
blocks.setIdAt(x, 0, z, BEDROCK_BLOCK_STATE);
372+
}
371373
}
372374
}
373375
}

0 commit comments

Comments
 (0)