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

NullPointerException #43

Open
sanjaykumarm opened this issue Apr 6, 2016 · 8 comments
Open

NullPointerException #43

sanjaykumarm opened this issue Apr 6, 2016 · 8 comments

Comments

@sanjaykumarm
Copy link

I am using com.plattysoft.leonids:LeonidsLib:1.3.1 version of this library and getting the following crashes from google play store :

java.lang.NullPointerException
! 1 at com.plattysoft.leonids.ParticleSystem.onUpdate(ParticleSystem.java:556)
2 at com.plattysoft.leonids.ParticleSystem.access$100(ParticleSystem.java:35)
3 at com.plattysoft.leonids.ParticleSystem$1.run(ParticleSystem.java:363)
4 at java.util.Timer$TimerImpl.run(Timer.java:284)

So can you please check it and resolve it?

@plattysoft
Copy link
Owner

There is a lot of information missing here.
Is this a crash on the Demo app on Play Store? If so, on which example? And what are the steps to replicate. Is it 100% replicable?
I did re-check the examples right now and they seem to work fine.

If this is something you are getting on you own app, please post the code, you may be doing something wrong on the initialization of the Particle System.

@sanjaykumarm
Copy link
Author

  • Is this a crash on the Demo app on Play Store?
    Ans : It is on play store.
  • It is not re-producible from my end but occasionally I am getting this error on google play store console and also getting this crash log on https://www.apteligent.com/

@plattysoft
Copy link
Owner

That was not my question. The question was if the crash was happening on the Demos, not if your app was on the Play Store.

Without steps to replicate, there's nothing I can do.

@raymondctc
Copy link

raymondctc commented May 5, 2016

I have integrated the lib into my app and I have the same issue too. Not sure what's going on and here is the stacktrace from Crashlytics

Fatal Exception: java.lang.NullPointerException
       at com.plattysoft.leonids.ParticleSystem.onUpdate(ParticleSystem.java:556)
       at com.plattysoft.leonids.ParticleSystem.access$100(ParticleSystem.java:35)
       at com.plattysoft.leonids.ParticleSystem$2.onAnimationUpdate(ParticleSystem.java:445)
       at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1251)
       at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1175)
       at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1216)
       at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:637)
       at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:660)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
       at android.view.Choreographer.doCallbacks(Choreographer.java:574)
       at android.view.Choreographer.doFrame(Choreographer.java:543)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5372)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:970)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:786)
       at dalvik.system.NativeStart.main(NativeStart.java)

@raymondctc
Copy link

raymondctc commented May 6, 2016

@smeet123 I probably figure out the reason for my case. I've been using a View.post() to force the animation to run on UI thread. I also have a destroy() call to .cancel() in ParticleSystem. It is very likely that the Runnable in my View.post() function executed after .cancel(), where mDrawingView will become null (check the code in onUpdate() and cancel()). See if that's your case too.

@sanjaykumarm
Copy link
Author

@raymondctc Thank you so much for the solution, I will check it once I get time.

@smr99
Copy link

smr99 commented Dec 30, 2016

May not be the cause of the reported NPE, but I can see a data race in ParticleTimerTask.run():

    if(mPs.get() != null) {
        ParticleSystem ps = mPs.get();

The two lines should be inverted:

    ParticleSystem ps = mPs.get();
    if(ps != null) {

@renyuzhuo
Copy link

The same

@ryust ryust mentioned this issue Aug 15, 2018
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

5 participants