Wither spawning can cause a crash
Fourmisain opened this issue ยท 0 comments
I was playing on a multiplayer server and tried spawning a Wither.
Just after placing the last wither skull the game crashed with
java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2631.method_11334()" because "skull" is null
at Not Enough Crashes deobfuscated stack trace.(1.16.5+build.6)
at mcp.mobius.waila.plugin.vanilla.PlayerHeadComponent.getDisplayItem(PlayerHeadComponent.java:26)
at mcp.mobius.waila.overlay.Raycast.getDisplayItem(Raycast.java:102)
at mcp.mobius.waila.overlay.Tooltip.hasItem(Tooltip.java:148)
at mcp.mobius.waila.overlay.Tooltip.render(Tooltip.java:197)
at net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback.lambda$static$0(HudRenderCallback.java:27)
at net.minecraft.client.gui.hud.InGameHud.handler$zff000$render(InGameHud:1841)
at net.minecraft.client.gui.hud.InGameHud.render(InGameHud:376)
...
I wasn't able to reproduce the issue in singleplayer and it might be caused by Accurate Block Placement which seems to have placed a 4th skull. Maybe there's some kind of timing issue where the block was (re?)placed locally but the block entity was deleted due to the wither spawning - or something like that.
Either way, the fix should be to add some null
checks at these places:
I looked through the code for other unchecked getBlockEntity()
instances and found this one:
It's unlikely that this could cause issues, except maybe then command blocks or creative players adding/removing spawners are involed, a null
check wouldn't hurt tough.
P.S. I would have made this a PR, but it's been what feels like 30 mins and it is still downloading dependencies... ๐