Skip to content

Commit

Permalink
[BottomSheet] Fixed NullPointerException when calling updatePeekHeigh…
Browse files Browse the repository at this point in the history
…t with null viewRef

PiperOrigin-RevId: 323107185
  • Loading branch information
dsn5ft committed Aug 4, 2020
1 parent 1047370 commit 34df6d9
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -770,20 +770,22 @@ public final void setPeekHeight(int peekHeight, boolean animate) {
}
// If sheet is already laid out, recalculate the collapsed offset based on new setting.
// Otherwise, let onLayoutChild handle this later.
if (layout && viewRef != null) {
if (layout) {
updatePeekHeight(animate);
}
}

private void updatePeekHeight(boolean animate) {
calculateCollapsedOffset();
if (state == STATE_COLLAPSED) {
V view = viewRef.get();
if (view != null) {
if (animate) {
settleToStatePendingLayout(state);
} else {
view.requestLayout();
if (viewRef != null) {
calculateCollapsedOffset();
if (state == STATE_COLLAPSED) {
V view = viewRef.get();
if (view != null) {
if (animate) {
settleToStatePendingLayout(state);
} else {
view.requestLayout();
}
}
}
}
Expand Down

0 comments on commit 34df6d9

Please sign in to comment.