Chat Heads

Chat Heads

35M Downloads

NullPointerException: "cmd" is null in ChatHeads mod (1.21 Fabric)

Matias-yay opened this issue ยท 2 comments

commented

Description:
When joining a server or processing chat messages, a NullPointerException occurs in the ChatHeads mod. The issue is caused by the method ChatHeads.lambda$getTellReceiver$0 trying to invoke the method String.startsWith() on a null object (cmd). This error likely happens when the mod attempts to process or detect the receiver of a private message or similar functionality.

The specific error trace points to ChatHeads.java:207 and involves chat processing in the mod, which breaks due to a null value passed where a string is expected. This might occur during packet handling or when displaying system messages from the server.

Stacktrace:

java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "cmd" is null
at dzwdz.chat_heads.ChatHeads.lambda$getTellReceiver$0(ChatHeads.java:207)
at net.minecraft.class_8828$class_2585.method_27660(class_8828.java:44)
at net.minecraft.class_2561.method_27658(class_2561.java:97)
at net.minecraft.class_2561.method_27658(class_2561.java:103)
at dzwdz.chat_heads.ChatHeads.getTellReceiver(ChatHeads.java:201)
at dzwdz.chat_heads.ChatHeads.detectPlayerByHeuristic(ChatHeads.java:184)
at dzwdz.chat_heads.ChatHeads.detectPlayer(ChatHeads.java:127)
at dzwdz.chat_heads.ChatHeads.handleAddedMessage(ChatHeads.java:109)
at net.minecraft.class_7594.handler$zpe000$chat_heads$chatheads$handleAddedSystemMessage(class_7594.java:1044)
at net.minecraft.class_7594.method_44736(class_7594.java:196)

Steps to Reproduce:
Use Minecraft 1.21 with Fabric and the ChatHeads mod installed.
Connect to a server (NetheritePaper with Velocity).
Wait for the server to send chat-related packets or system messages.
Additional Information:
Minecraft version: 1.21
Mod version: ChatHeads 0.13.2
OS: macOS 15.0 (M1)
Java version: Microsoft OpenJDK 21.0.3

commented

Hm... that's a click event without a string value...?
Looks like an issue with the server plugins as in vanilla this is never null - this can even cause crashes when hashCode or equals is called on said event.
I'll just add a safeguard anyway.

commented

Fixed in 0.13.3.