0

I am coding a game in libgdx and handled everything pretty gracefully. Everything is working fine. But when you try to resume the game after 10 mins or so, game crashes.Due to inner workings of phone memory issues

01-10 15:38:48.757 31427-31885/com.game.pack E/AndroidRuntime: FATAL EXCEPTION: Thread-12
Process: com.game.pack, PID: 31427
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
    at com.android.tools.profiler.support.profilers.EventProfiler$InputConnectionHandler.run(EventProfiler.java:285)
    at java.lang.Thread.run(Thread.java:764)

Here is the pause/resume:

@Override
public void pause() {


    EnumClass.state = EnumClass.State.PAUSE;

}

@Override
public void resume() {

            EnumClass.state = EnumClass.State.PAUSE;       

}

Any ideas?

Fractal
  • 88
  • 1
  • 6
  • 1
    See e.g. https://stackoverflow.com/questions/52156219/fatal-exception-thread-5-nullpointer-object-getclass and https://stackoverflow.com/questions/47440771/focus-on-edittext-result-in-crash – Michael Jan 10 '19 at 13:29
  • Profiler was the culprit. Nice to know distribution wont have this bug. Thanks. – Fractal Jan 10 '19 at 13:55
  • 1
    Your pause() and resume() methods are both doing the same thing. i.e. EnumClass.state = EnumClass.State.PAUSE; Which class are you extending or implementing in your code? Which class did you import? The pause() method should have something like this, for example: // Gdx.app.log("P: ", "pause"); super.pause(); The resume() method should have something like this, for example: // Gdx.app.log("R: ", "resume"); super.resume(); This should handle pausing and resuming respectively. – BM3 Jan 10 '19 at 17:30

0 Answers0