@@ -510,7 +510,7 @@ public boolean onTouchEvent(
510510 velocityTracker .addMovement (event );
511511 // The ViewDragHelper tries to capture only the top-most View. We have to explicitly tell it
512512 // to capture the bottom sheet in case it is not captured and the touch slop is passed.
513- if (action == MotionEvent .ACTION_MOVE && !ignoreEvents ) {
513+ if (viewDragHelper != null && action == MotionEvent .ACTION_MOVE && !ignoreEvents ) {
514514 if (Math .abs (initialY - event .getY ()) > viewDragHelper .getTouchSlop ()) {
515515 viewDragHelper .captureChildView (child , event .getPointerId (event .getActionIndex ()));
516516 }
@@ -1296,9 +1296,10 @@ void settleToState(@NonNull View child, int state) {
12961296
12971297 void startSettlingAnimation (View child , int state , int top , boolean settleFromViewDragHelper ) {
12981298 boolean startedSettling =
1299- settleFromViewDragHelper
1300- ? viewDragHelper .settleCapturedViewAt (child .getLeft (), top )
1301- : viewDragHelper .smoothSlideViewTo (child , child .getLeft (), top );
1299+ viewDragHelper != null
1300+ && (settleFromViewDragHelper
1301+ ? viewDragHelper .settleCapturedViewAt (child .getLeft (), top )
1302+ : viewDragHelper .smoothSlideViewTo (child , child .getLeft (), top ));
13021303 if (startedSettling ) {
13031304 setStateInternal (STATE_SETTLING );
13041305 // STATE_SETTLING won't animate the material shape, so do that here with the target state.
0 commit comments