commit | 5f3d6e743d06b660b8023e250e482eb37e515746 | [log] [tgz] |
---|---|---|
author | Geoffrey Métais <geoffrey.metais@gmail.com> | Mon Mar 06 18:17:06 2017 +0100 |
committer | Shubham Singh <coolsks94@gmail.com> | Fri Mar 31 15:56:34 2017 +0530 |
tree | 3428f65d70a3a7bc5e27a6bf6abeca968dfc8182 | |
parent | c67e055dc85ff595a5dda3972895929f7eaa42a6 [diff] |
Prevent potential NPE Ignore scroll events if mNestedScrollingChildRef is not set yet. It happens if BottomSheetBehavior view is inflated from a ViewStub for example, input events can arrive too soon. bug: https://code.google.com/p/android/issues/detail?id=232646 Test: nullity check, existing unit tests still pass. Change-Id: I25847ce70437d33b864b0d1b27a28d215a7c1ab3
diff --git a/design/src/android/support/design/widget/BottomSheetBehavior.java b/design/src/android/support/design/widget/BottomSheetBehavior.java index e36e2ab..77563a9 100644 --- a/design/src/android/support/design/widget/BottomSheetBehavior.java +++ b/design/src/android/support/design/widget/BottomSheetBehavior.java
@@ -385,7 +385,8 @@ setStateInternal(STATE_EXPANDED); return; } - if (target != mNestedScrollingChildRef.get() || !mNestedScrolled) { + if (mNestedScrollingChildRef == null || target != mNestedScrollingChildRef.get() + || !mNestedScrolled) { return; } int top;