Coders-After-Dark / Reskillable

Other
7 stars 17 forks source link

Button render can cause null pointer crash #175

Closed Charnuz closed 4 years ago

Charnuz commented 4 years ago

This for some reason happened as I went to exit world.

Reskillable: 1.12.5 Forge: 14.23.5.2838

crash.txt

pupnewfster commented 4 years ago

Not sure why this was happening but added something that should fix it. I hope to release an update by the end of the week that includes this fix.

Charnuz commented 4 years ago

Can confirm this still happens with version 1.13.0. Created a new issue #181 as the button itself is not the cause.

https://github.com/Coders-After-Dark/Reskillable/blob/58d6b434d163c9e80432a6be4b3998233c8afc65/src/main/java/codersafterdark/reskillable/api/data/PlayerDataHandler.java#L24-L49

Depending on if PlayerDataHandler.get() can return null (meaning PlayerData.get() also can return null), the button should handle this properly.

The button itself appears to handle null correctly. https://github.com/Coders-After-Dark/Reskillable/blob/58d6b434d163c9e80432a6be4b3998233c8afc65/src/main/java/codersafterdark/reskillable/client/gui/button/GuiButtonInventoryTab.java#L68-L88