Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PreviewPlayer can have null playerInfo but return true in hasPlayerInfo() #277

Open
serenibyss opened this issue Mar 1, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@serenibyss
Copy link

serenibyss commented Mar 1, 2022

Versions (Be specific, do not write "latest"):

  • Construct's Armory: 1.2.5.10
  • Tinkers' Construct: 2.13.0.183
  • Mantle: Latest 1.3.3.55
  • Forge: Latest 14.23.5.2860

Observed Behavior:

Calling hasPlayerInfo() on an instance of AbstractClientPlayer (specifically in RenderPlayerEvent.Pre in this case) and receiving a return value of true still leads to a NPE on accessing the playerInfo field.

Expected Behavior:

When calling hasPlayerInfo() on an instance of AbstractClientPlayer, a return value of true should mean that accessing the playerInfo field of that Object should not be null.

Steps to Reproduce:

This requires some other mod since this breaks an invariant of the AbstractClientPlayer class that is expected to be true. This can be observed with any currently released version of GregTech CE Unofficial (v2.1.4 or earlier, as we have worked around it in subsequent releases).

In c4.conarm.client.gui.PreviewPlayer, an override of hasPlayerInfo() should be sufficient to address this issue. Unfortunately since getPlayerInfo() is protected, there is no way for us to call that instead of directly accessing the field. As a workaround, we have resulted in null-checking the playerInfo field, but this issue could cause issues with other mods who have not done this fix.

Crash Log:
https://pastebin.com/dAbNcjcd

Issue from our end:
GregTechCEu/GregTech#615

@serenibyss serenibyss added the bug Something isn't working label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants