Globox1997 / TalkBubbles

https://modrinth.com/mod/talkbubbles
https://www.curseforge.com/minecraft/mc-mods/talkbubbles
MIT License
10 stars 7 forks source link

NPE when message is printed before world is loaded #6

Closed Johni0702 closed 1 year ago

Johni0702 commented 1 year ago

If a third-party mod prints a message into the chat before the world is loaded, TalkBubble's mixin will throw a NPE:

java.lang.NullPointerException: Cannot invoke "net.minecraft.class_746.method_5829()" because "this.field_2062.field_1724" is null
    at net.minecraft.class_338.handler$gnp000$addMessageMixin(class_338.java:4544)
    at net.minecraft.class_338.method_44811(class_338.java)
    at net.minecraft.class_338.method_1812(class_338.java:187)
    at com.replaymod.core.ReplayMod.printToChat(ReplayMod.java:256)
    at com.replaymod.core.ReplayMod.printInfoToChat(ReplayMod.java:221)
    at com.replaymod.recording.handler.ConnectionEventHandler.onConnectedToServerEvent(ConnectionEventHandler.java:160)
    at com.replaymod.recording.ReplayModRecording.initiateRecording(ReplayModRecording.java:101)
Globox1997 commented 1 year ago

looks like an incompatibility cause the client should not be null in the ChatHud class. However, fixed the issue with null checks https://github.com/Globox1997/TalkBubbles/commit/e4c7238a73fd0833383eb4ccdafdd64d9e5e10c3