Skip to content

NullPointerException on ValueAnimator #5

Description

@Zhelyazko

I've got a NPE when updating the visibility of LoadingDots to Visible.

Stacktrace:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.animation.ValueAnimator.isRunning()' on a null object reference at com.eyalbira.loadingdots.LoadingDots.startAnimationIfAttached(LoadingDots.java:167) at com.eyalbira.loadingdots.LoadingDots.setVisibility(LoadingDots.java:148)

I have LoadingDots_auto_play=false. I checked the code and found the issue here:
private void startAnimationIfAttached() { if (mIsAttachedToWindow && !mAnimation.isRunning()) { mAnimation.start(); } }

It seems that mAnimation is null when autoplay is false. You've added check whether mAnimation is null anywhere you are invoking methods on it but here :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions