Fatal Exception: java.lang.NullPointerException: Action.act(float) on a null object reference
See original GitHub issueIssue 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:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
oups! good point
Provided code can’t cause your crash. Somewhere in your code, you must be adding
RepeatAction
withnull
action to repeat. This could be caused by releasing theRepeatAction
back to its pool without actually removing it from the Actor. (Or maybe you are adding singleRepeatAction
instance to multipleActor
s).Anyway, this does not appear to be a libGDX problem, so it would be more suited for the forum or IRC.