[Android] Prevent division by zero in Bottom Sheet
If the state changes while or briefly after the bottom sheet is hidden, the BottomSheet#sendOffsetChangeEvents triggers without sheet content which sets the maximum full ratio to 0. Since the hidden full ration is divided by that maximum full ration, the result is NaN which is then propagated to Observers [1]. [1] Sample stack trace of an Observer receiving NaN after onLayout: BottomContainer${EmptyBottomSheetObserver}#onSheetOffsetChanged(NaN, 0); at Rz1.a(PG:2) at org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.a(PG:102) at org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.a(PG:127) at TV1.onLayoutChange(PG:40) at android.view.View.layout(View.java:19677) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) Bug: 1021885 Change-Id: I21573d91b92f1c017ec2267381c196ae79903545 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1901566Reviewed-by:Matthew Jones <mdjones@chromium.org> Commit-Queue: Friedrich [CET] <fhorschig@chromium.org> Cr-Commit-Position: refs/heads/master@{#713381}
Showing
Please register or sign in to comment