-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NullPointerException in AnimLayer.update() #1730
Fix NullPointerException in AnimLayer.update() #1730
Conversation
java.lang.NullPointerException: Cannot invoke "com.jme3.anim.tween.action.Action.setMask(com.jme3.anim.AnimationMask)" because "this.currentAction" is null at com.jme3.anim.AnimLayer.update(AnimLayer.java:209) at com.jme3.anim.AnimComposer.controlUpdate(AnimComposer.java:391) at com.jme3.scene.control.AbstractControl.update(AbstractControl.java:118) at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:743) at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:890) at com.jme3.scene.Node.updateLogicalState(Node.java:228) at com.jme3.scene.Node.updateLogicalState(Node.java:239)
Looks good to me, thank you @capdevon! Unless there's substantial discussion, I plan to integrate this in about 24 hours. |
Does the choice of variable name count as substantial discussion? |
Yes, I think so. Please continue the discussion about the variable name, I will delay the merge until we resolve it. Thanks! |
* NullPointerException in AnimLayer.update() java.lang.NullPointerException: Cannot invoke "com.jme3.anim.tween.action.Action.setMask(com.jme3.anim.AnimationMask)" because "this.currentAction" is null at com.jme3.anim.AnimLayer.update(AnimLayer.java:209) at com.jme3.anim.AnimComposer.controlUpdate(AnimComposer.java:391) at com.jme3.scene.control.AbstractControl.update(AbstractControl.java:118) at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:743) at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:890) at com.jme3.scene.Node.updateLogicalState(Node.java:228) at com.jme3.scene.Node.updateLogicalState(Node.java:239) * rename runningAction -> action
Confirmed fixed in v3.5.0-beta6 ... https://hub.jmonkeyengine.org/t/v3-5-0-beta-testing/45209/26 |
Edit:
Link to the forum post: https://hub.jmonkeyengine.org/t/v3-5-0-beta-testing/45209/17
Edit 2:
To facilitate the understanding of the problem I also add the explanation of the fix discussed on the forum and suggested by Ali-RS: "the
currentAction
should be copied into a local variable insideAnimLayer.update()
because it might be changed, removed or replaced with new action inAction.interpolate(time)
"For clarity here is a sample code that can cause the exception: