DragSortController: Check for null MotionEvent arguments (#202)

This fixes a rare crash on Samsung Galaxy S6 devices. The null arguments
appear to be caused by the GestureDetector not receiving an ACTION_DOWN
event before receiving an ACTION_MOVE event.

As we are unable to reproduce it, this commit work around the issue. It
might cause some scrolling issues in the cases that cause the issue, but
better than crashing.
This commit is contained in:
Xiao Bao Clark 2015-09-26 10:13:16 +10:00
parent 83c037d1de
commit 4556d50eda

View File

@ -378,6 +378,11 @@ public class DragSortController extends SimpleFloatViewManager implements View.O
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
// Guard against rare case of null MotionEvents on some devices
if (e1 == null || e2 == null) {
return false;
}
final int x1 = (int) e1.getX();
final int y1 = (int) e1.getY();
final int x2 = (int) e2.getX();