[Fabric 1.19.4 v2.7] | Error connecting to the server
IFedor-F opened this issue ยท 6 comments
Hi, I have a strange bug when connecting to the server
https://mclo.gs/NNM9lOz
I noticed this bug only on one server, when connecting to others everything is fine
Hello! Thanks a lot for respoting the bug.
Here's a technical explanation of what I believe might be going on if you're interested in reading it.
So, I've been examining the Yarn deobfuscation mappings to deobfuscate the error message and identify its cause. Here's what I've found:
- `field_1724` is the `player` field in the `MinecraftClient` class
- `FIELD field_1724 player Lnet/minecraft/class_746;`
- `class_746` is the `ClientPlayerEntity`
- `CLASS net/minecraft/class_746 net/minecraft/client/network/ClientPlayerEntity`
- `method_7334` pertains to a player's `GameProfile`
- `METHOD method_7334 getGameProfile ()Lcom/mojang/authlib/GameProfile;`
I'll try to simplify this:
The `MinecraftClient` class is crucial for the client-side game as it tracks everything that happens when you start the game. It has a field/property named `player` which is of the type `ClientPlayerEntity`. This property tracks the player on your end (client-side player) when you're in-game, but it is "undefined" when you're in the main menu.
The error appears to be occurring because something is trying to access the `player` property before it's defined. When you join a world, the `player` is undefined until you're fully logged into a server. If something triggers a mod (possibly mine) to access the `player` property before it's defined, a `NullPointerException` error occurs, which basically means "Hey, you're trying to access something that doesn't exist".
So with the technical explanation above in mind, I'm not sure why my mod (if indeed it is the cause) would attempt to access the "player" property during server login. Thanks for the logs as well, as they are vrey helpful, but unfortunately, they do not include the error's "stack trace". In case you don't know what that is, a "stack trace" is an essential debugging tool that indicates exactly which lines of code are causing issues, so the absence of the stack trace might be due to the game not including it.
From what I see in the mod's code, one possible issue could occur if a server sends player statistics during the login process. This might cause Better Stats
to attempt to read these statistics and associate them with the "player" property, which at that moment is still "undefined", leading to the error. Although it's unclear why a server would send player statistics during login, altho I will update the mod to handle this situation just in case this is indeed the source of the problem. I'll also look further into my code to make sure I didn't miss any other potential flaws.
In the meantime, could you let me know if this specifically takes place while Better Stats
is installed? Thanks again for the bug report, and have a great day!
I can't test this with stack trace, but without this mod I can go in
If necessary, I can give you the ip of the server
Thanks for support
I fixed that one line of code and published a temp. pre-release here on GitHub:
https://github.com/TheCSMods/mc-better-stats/releases/tag/v2.7.1
Please give it a try and see if it fixes your issue before I publish the patch.