From 3fbc8276f724079cb0e0ddd3899c3b49a40e11d9 Mon Sep 17 00:00:00 2001 From: "asargent@chromium.org" Date: Tue, 12 Jan 2010 18:06:44 +0000 Subject: Fix a crash with application mode windows and extensions tab API. From an application mode window, if you call chrome.tabs.create and specify a index for the new tab (and had no other windows open), chrome will crash. BUG=29810 TEST=Crash should no longer happen when following steps in the bug report. Review URL: http://codereview.chromium.org/542018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36019 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/tabs/tab_strip_model.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'chrome') 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(); } -- cgit v1.1