Commit 0a2b2026 authored by Matt Jones's avatar Matt Jones Committed by Commit Bot

Add exceptions to help diagnose null sheet content

This patch throws exceptions for cases that shouldn't be happening
when using the bottom sheet. These will hopefully help track down an
issue where the sheet is visible with null content.

Bug: 1126872
Change-Id: I65789df1a569674d19610f41e50b45e21edb1136
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2403902Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805904}
parent 531e2bae
......@@ -377,6 +377,10 @@ class BottomSheetControllerImpl implements ManagedBottomSheetController {
@Override
public boolean requestShowContent(BottomSheetContent content, boolean animate) {
if (content == null) {
throw new RuntimeException("Attempting to show null content in the sheet!");
}
if (mBottomSheet == null) mSheetInitializer.run();
// If already showing the requested content, do nothing.
......@@ -456,6 +460,10 @@ class BottomSheetControllerImpl implements ManagedBottomSheetController {
* @param animate Whether the sheet should animate opened.
*/
private void showNextContent(boolean animate) {
if (mBottomSheet.getSheetState() != SheetState.HIDDEN) {
throw new RuntimeException("Showing next content before sheet is hidden!");
}
if (mContentQueue.isEmpty()) {
mBottomSheet.showContent(null);
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment