Commit 812d6873 authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

Fix TabGroup crashing when closing all tabs

When "close all tabs", the current tab which is the next tab can be
null. We should use the tab from parameter instead of using current tab.

Change-Id: Ic696b68131755e0b4224e1263995340a4e30b178
Bug: 968949
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1639009
Commit-Queue: Mei Liang <meiliang@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665415}
parent 9d2d779c
......@@ -97,14 +97,11 @@ public class TabGroupUiMediator {
@Override
public void willCloseTab(Tab tab, boolean animate) {
if (!mIsTabGroupUiVisible) return;
Tab currentTab = mTabModelSelector.getCurrentTab();
if (currentTab == null) mResetHandler.resetSheetWithListOfTabs(null);
int tabsCount = mTabModelSelector.getTabModelFilterProvider()
.getCurrentTabModelFilter()
.getRelatedTabList(currentTab.getId())
.size();
List<Tab> group = mTabModelSelector.getTabModelFilterProvider()
.getCurrentTabModelFilter()
.getRelatedTabList(tab.getId());
mIsClosingAGroup = tabsCount == 0;
mIsClosingAGroup = group.size() == 0;
}
@Override
......
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