Skip to content
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

[Android] NullPointerException - Attempt to invoke virtual method 'void com.swmansion.reanimated.nodes.ValueNode.setValue(java.lang.Object)' on a null object reference #559

Closed
alimek opened this issue Jan 16, 2020 · 1 comment

Comments

@alimek
Copy link
Contributor

alimek commented Jan 16, 2020

Hello,

after switching to react-native-reanimated 1.5.0 i started to seen crashes on Android. Updating to 1.6.0 is not solving problem.

Stack trace:

E/unknown:ReactNative: Exception in native call
    java.lang.NullPointerException: Attempt to invoke virtual method 'void com.swmansion.reanimated.nodes.ValueNode.setValue(java.lang.Object)' on a null object reference
        at com.swmansion.reanimated.NodesManager.setValue(NodesManager.java:405)
        at com.swmansion.reanimated.ReanimatedModule$12.execute(ReanimatedModule.java:222)
        at com.swmansion.reanimated.ReanimatedModule$1.execute(ReanimatedModule.java:82)
        at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(UIViewOperationQueue.java:498)
        at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:779)
        at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:888)
        at com.facebook.react.uimanager.UIViewOperationQueue.access$2200(UIViewOperationQueue.java:42)
        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:948)
        at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:28)
        at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:174)
        at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:84)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:947)
        at android.view.Choreographer.doCallbacks(Choreographer.java:761)
        at android.view.Choreographer.doFrame(Choreographer.java:693)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Changing code from

public void setValue(int nodeID, Double newValue) {
    Node node = mAnimatedNodes.get(nodeID); 
    ((ValueNode) node).setValue(newValue);
  }

to

public void setValue(int nodeID, Double newValue) {
    Node node = mAnimatedNodes.get(nodeID);
    if (node != null) {
     ((ValueNode) node).setValue(newValue);
    }
  }

is fixing problem, but not sure if this is right fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants