question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fatal Exception: java.lang.NullPointerException: Action.act(float) on a null object reference

See original GitHub issue

Issue details

Crash appears while rendering screen.

Reproduction steps/code

StageScreen

public void render(float delta) {
        Gdx.gl.glClear(16384);
        if(null != this.stage) {
            this.stage.act(delta);
            this.stage.draw();
        }

    }

BaseScreen

 @Override
    public void render(float delta) {
        super.render(delta);
        if (null != fpsLabel) {
            fpsLabel.setText(String.valueOf(Gdx.graphics.getFramesPerSecond()));
        }
    }

BaseGame

public void render() {
        if(this.screen != null) {
            this.screen.render(Math.min(Gdx.graphics.getDeltaTime(), 0.033333335F));
        }
    }

Version of LibGDX and/or relevant dependencies

gdxVersion = ‘1.9.6’

Stacktrace

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.badlogic.gdx.scenes.scene2d.Action.act(float)' on a null object reference
       at com.badlogic.gdx.scenes.scene2d.actions.RepeatAction.delegate(SourceFile:29)
       at com.badlogic.gdx.scenes.scene2d.actions.DelegateAction.act(SourceFile:43)
       at com.badlogic.gdx.scenes.scene2d.Actor.act(SourceFile:96)
       at com.badlogic.gdx.scenes.scene2d.Group.act(SourceFile:49)
       at com.badlogic.gdx.scenes.scene2d.Group.act(SourceFile:49)
       at com.badlogic.gdx.scenes.scene2d.Stage.act(SourceFile:221)
       at ....StageScreen.render(SourceFile:98)
       at ....BaseScreen.render(SourceFile:71)
       at ....BaseGame.render(SourceFile:97)
       at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(SourceFile:459)
       at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1583)
       at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1286)

Please select the affected platforms

  • Android
  • iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
julienvillegascommented, Feb 6, 2018

oups! good point

1reaction
Darkyenuscommented, Feb 6, 2018

Provided code can’t cause your crash. Somewhere in your code, you must be adding RepeatAction with null action to repeat. This could be caused by releasing the RepeatAction back to its pool without actually removing it from the Actor. (Or maybe you are adding single RepeatAction instance to multiple Actors).

Anyway, this does not appear to be a libGDX problem, so it would be more suited for the forum or IRC.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NullPointerException: Attempt to invoke virtual ...
I I have created an app that was working perfectly before I introduced ViewFlipper into it. I really need to use this, but...
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
The NullPointerException occurs due to a situation in application code where an uninitialized object is attempted to be accessed or modified.
Read more >
'float android.content.res.Configuration.fontScale' on a null ...
java.lang.NullPointerException: Attempt to read from field 'float android.content.res.Configuration.fontScale' on a null object reference
Read more >
Bug descriptions — spotbugs 4.7.3 documentation
A method that returns either Boolean.TRUE, Boolean.FALSE or null is an accident waiting to happen. This method can be invoked as though it...
Read more >
How to resolve the java.lang.NullPointerException - Educative.io
This error can be resolved by using a try-catch block or an if-else condition to check if a reference variable is null before...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found