Commit 5519db3a authored by Connie Wan's avatar Connie Wan Committed by Commit Bot

Add a check for tabs inserted into an empty group

This is currently causing a small number of crashes in a corner case with no known repro (see attached bug).

It may become a more common pattern if extensions are able to create new, singleton grouped tabs, or if grouped tabs can be restored into new singletons.

Bug: 1006708
Change-Id: I8720b021fe8cd3c677eefa7e7f7639672673b10e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825660Reviewed-by: default avatarTaylor Bergquist <tbergquist@chromium.org>
Commit-Queue: Connie Wan <connily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700026}
parent 0992399f
......@@ -987,9 +987,11 @@ void TabStripModel::AddWebContents(std::unique_ptr<WebContents> contents,
// so we have to handle the general case.
if (group.has_value()) {
auto grouped_tabs = ListTabsInGroup(group.value());
DCHECK(base::STLIsSorted(grouped_tabs));
index = base::ClampToRange(index, grouped_tabs.front(),
grouped_tabs.back() + 1);
if (grouped_tabs.size() > 0) {
DCHECK(base::STLIsSorted(grouped_tabs));
index = base::ClampToRange(index, grouped_tabs.front(),
grouped_tabs.back() + 1);
}
}
if (ui::PageTransitionTypeIncludingQualifiersIs(transition,
......
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