Crendgrim / AutoHUD

A Minecraft mod for the Fabric launcher which dynamically hides parts of the user interface
GNU Lesser General Public License v3.0
18 stars 12 forks source link

[Bug] NullPointerException in ClientPlayNetworkHandler on getScoreboard() with Auto HUD #136

Closed wling-art closed 6 days ago

wling-art commented 6 days ago

Description: When playing Minecraft with the Auto HUD mod enabled, the game crashes due to a NullPointerException in the ClientPlayNetworkHandler class. This issue occurs when attempting to handle a team update packet (clientbound/minecraft:set_player_team). It appears that the world object is null, causing the getScoreboard() method to fail.

Steps to Reproduce:

  1. Launch Minecraft with the Auto HUD mod installed.
  2. Connect to a multiplayer server.
  3. The game crashes with the attached error.

Expected Behavior: The game should handle team update packets without crashing.

Actual Behavior: The game crashes with a NullPointerException.

Crash Log:

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.world.ClientWorld.getScoreboard()" because "this.world" is null
    at MC//net.minecraft.client.network.ClientPlayNetworkHandler.handler$zzd000$autohud$autoHud$onTeamUpdate(ClientPlayNetworkHandler.java:3513)
    at MC//net.minecraft.client.network.ClientPlayNetworkHandler.onTeam(ClientPlayNetworkHandler.java:2027)
    at MC//net.minecraft.network.packet.s2c.play.TeamS2CPacket.apply(TeamS2CPacket.java:132)
    ...

System Details:

Additional Notes:

disconnect-2024-11-28_18.28.55-client.txt

Crendgrim commented 6 days ago

Thank you for the detailed bug report! Servers are acting in ever more surprising ways; why are they updating teams before the world even exists? Should be an easy fix though!