Skip to content


Browse files Browse the repository at this point in the history
Do not crash when ScrollView snapToOffsets is empty
The value of the `ScrollView.snapToOffsets` property can be an empty array (most likely an issue in the product code), which will crash the app. This diff adds a check to prevent crashing in this scenario and falling back to the default snap behaviour.

[Android][Fixed] - Do not crash when ScrollView snapToOffsets is empty

Reviewed By: sammy-SC

Differential Revision: D24502365

fbshipit-source-id: c63b8e3b8f2fb323ebd6c962ee628015934d8e11
  • Loading branch information
makovkastar authored and facebook-github-bot committed Oct 23, 2020
1 parent 6eed1e4 commit d238da7
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -817,7 +817,7 @@ private void flingAndSnap(int velocityX) {

// get the nearest snap points to the target offset
if (mSnapOffsets != null) {
if (mSnapOffsets != null && !mSnapOffsets.isEmpty()) {
firstOffset = mSnapOffsets.get(0);
lastOffset = mSnapOffsets.get(mSnapOffsets.size() - 1);

Expand Down

0 comments on commit d238da7

Please sign in to comment.