Arcnor / pixel-dungeon-gdx

LibGDX port of the awesome Pixel Dungeon
95 stars 83 forks source link

Fixed NPE when clicking outside game window and then returning back #52

Closed onix closed 9 years ago

onix commented 9 years ago

Hi, I've found a bug (in Ubuntu, but probably actual for other OSes): when the game is running, you can click somewhere outside the window (e.g. on volume control, but the window must be on screen during these operations, not hidden) and then when you return back to game (click inside game window), you'll catch NullPointerException with crash, because pointers map at this moment is empty, so up() method is not acceptable.

Exception in thread "LWJGL Application" java.lang.NullPointerException
    at com.watabou.pd.desktop.DesktopInputProcessor.touchUp(DesktopInputProcessor.java:121)
    at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:326)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:199)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)

This pull request contains a patch/proposal to fix this defect.

Arcnor commented 9 years ago

Thanks!