`PreviewPlayer` can have null playerInfo but return true in `hasPlayerInfo()`
serenibyss opened this issue ยท 0 comments
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