summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index c8920aa..d143c55 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -414,8 +414,9 @@ void TabStripModel::AddTabContents(TabContents* contents,
contents, transition, foreground);
inherit_group = true;
} else {
- // For all other types, respect what was passed to us, normalizing -1s.
- if (index < 0)
+ // For all other types, respect what was passed to us, normalizing -1s and
+ // values that are too large.
+ if (index < 0 || index > count())
index = count();
}