Weird NullPointer in Biome Colors
I've been experiencing this weird NPE crash for the last couple of weeks or so, while working on a server which does some custom terrain generation.
This crash occurs in both vanilla and modded (optifine, forge) versions of 1.13.2. The server mentioned also uses [ViaVersion|https://www.spigotmc.org/resources/viaversion.19254/] to support connections with 1.14. This is not the cause of the crash though, as I have also tested this without it, but it also catches a similar issue in the ChunkData packet, running out if ints to read here: https://github.com/ViaVersion/ViaVersion/blob/master/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/types/Chunk1_13Type.java#L58 suggesting a null element or something in the biome chunk data.
According to the attached crash logs, the Exception occurs in the BiomeColors.class in the #getColor method. I've been trying to debug this for the past few days now, and I am a bit confused as to how this NPE can even occur. So for the stuff I figured out about the affected line:
- #getColor of a BiomeColors$ColorResolver is called -> resolver can't be null as it is always a static variable passed in by one of the public methods in that class
- #getBiome is called on the IWorldReaderBase argument -> can't be null either, since the BlockColors.class does a !=null check before even calling any of the BiomeColors methods (same goes for the BlockPos argument)
- I tried overriding the GRASS_COLOR ColorResolver and noticed that the first argument (biome) can be null occasionally, so that might be the issue
. Though there's nothing on the server that should be able to cause a null Biome. Also, looking at the decompiled source, the NPE should occur in the Biome.class in #getTemperature, trying to get the y value of the possibly null BlockPos (maybe some decompiler weirdness, idk)
While digging around I also noticed that the WorldGenRegion.class' #getBiome method has actually checks if the returned biome is null and throws a RuntimeException, while other classes implementing that method don't.
As for the server (using PaperSpigot) I've also been digging around a bit and wasn't able to find anything that would cause a null Biome or empty array element in the ChunkData packet.
2019-05-06, 12:10 AM
2019-05-06, 11:20 AM
2019-05-06, 12:43 AM
0
1
-