egordorichev / LastTry

:deciduous_tree: LastTry is open-source game written in Java, using LibGDX library and inspired by Terraria :deciduous_tree:
MIT License
119 stars 17 forks source link

Game crashes when clicking specific inventory boxes #38

Closed Storm-Peter closed 7 years ago

Storm-Peter commented 7 years ago

When you click on any of the boxes to the right of the main inventory the game crashes giving this error

Exception in thread "LWJGL Application" java.lang.NullPointerException at org.egordorichev.lasttry.ui.UiItemSlot.canHold(UiItemSlot.java:165) at org.egordorichev.lasttry.ui.UiItemSlot.onStateChange(UiItemSlot.java:196) at org.egordorichev.lasttry.ui.UiComponent.update(UiComponent.java:153) at org.egordorichev.lasttry.ui.UiComponent.render(UiComponent.java:44) at org.egordorichev.lasttry.ui.UiItemSlot.render(UiItemSlot.java:82) at org.egordorichev.lasttry.ui.UiInventory.render(UiInventory.java:237) at org.egordorichev.lasttry.ui.UiManager.render(UiManager.java:11) at org.egordorichev.lasttry.state.GamePlayState.render(GamePlayState.java:118) at com.badlogic.gdx.Game.render(Game.java:46) at org.egordorichev.lasttry.LastTry.render(LastTry.java:166) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)

egordorichev commented 7 years ago

What do you mean by boxes?

egordorichev commented 7 years ago

I know, that Inventory UI is very buggy now, but I'm working on it and exception handling.

Storm-Peter commented 7 years ago

boxes

Any of these boxes being clicked causes the game to crash

egordorichev commented 7 years ago

I've updated the code, it should work now. Can you check it?

Storm-Peter commented 7 years ago

It's fixed

egordorichev commented 7 years ago

Thank you.

egordorichev commented 7 years ago

Implemented a crash handler:

LastTry had crashed!
-------------------
LastTry had stopped running, because it encountered a problem.

Please, copy and report the entire text to email egordorichev@gmail.com or
submit an issue https://github.com/egordorichev/LastTry/issues

--- BEGIN ERROR REPORT ---
LastTry version: v.0.3-alpha
OS: Linux (amd64) version 3.18.9-gentoo
Java version: 1.8.0_72, Oracle Corporation
Java VM version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Java VM flags: 0 total; 
Memory: 225378200 bytes (214 MB) / 243269632 bytes (232 MB) up to 3596091392 bytes (3429 MB)
Exception cause: java.lang.NullPointerException
    at org.egordorichev.lasttry.LastTry.create(LastTry.java:126)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
--- END ERROR REPORT ---