Skip to content

Initialize colorCircleList earlier to avoid race condition NPE #57

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

Merged
merged 1 commit into from
Aug 20, 2016

Conversation

Nilhcem
Copy link
Contributor

@Nilhcem Nilhcem commented Aug 8, 2016

A race condition on ColorPickerView makes apps crash

How to reproduce

  • Open the color picker sample
  • Tap multiple times quickly on Open dialog sampleor Open view sample buttons

It may require many tries to reproduce.
I personally had this crash a few times unintentionally.

com.flask.colorpicker.sample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.flask.colorpicker.sample, PID: 22545
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
    at com.flask.colorpicker.ColorPickerView.findNearestByPosition(ColorPickerView.java:261)
    at com.flask.colorpicker.ColorPickerView.onTouchEvent(ColorPickerView.java:210)
    at android.view.View.dispatchTouchEvent(View.java:9993)

This PR makes sure the AbsColorWheelRenderer.colorCircleList is never null

@QuadFlask QuadFlask closed this Aug 20, 2016
@QuadFlask QuadFlask reopened this Aug 20, 2016
@QuadFlask QuadFlask merged commit fcd045b into QuadFlask:master Aug 20, 2016
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

Successfully merging this pull request may close these issues.

2 participants