Commit 31c026a6 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fix a crash in navigation sheet

The reported crash can happen when navigation sheet's request to show
fails. It should have always called |hideContent| to remove itself
from the queue but it was done only when the current sheet state is
hidden. This CL fixes it to perform the hiding operation
unconditionally.

Bug: 1021932
Change-Id: I3fa3c08ff814d9aa2aa149196b9f5e91b262cb73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1910819Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714527}
parent 0c35924f
...@@ -244,9 +244,10 @@ class NavigationSheetCoordinator implements BottomSheetContent, NavigationSheet ...@@ -244,9 +244,10 @@ class NavigationSheetCoordinator implements BottomSheetContent, NavigationSheet
@Override @Override
public void close(boolean animate) { public void close(boolean animate) {
if (mBottomSheetController.get() == null) return; BottomSheetController controller = mBottomSheetController.get();
if (!isHidden()) mBottomSheetController.get().hideContent(this, animate); if (controller == null) return;
mBottomSheetController.get().removeObserver(mSheetObserver); controller.hideContent(this, animate);
controller.removeObserver(mSheetObserver);
mMediator.clear(); mMediator.clear();
} }
......
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