summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-26 18:32:54 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-26 18:32:54 +0000
commit7dc3984a455a6fde278f1d09548a71c7c0916637 (patch)
tree3c37317516950d885c16cc61f4c39db276968f4a
parent48ca0eee6d1a3aef905ce84c68d27a24718d140d (diff)
downloadchromium_src-7dc3984a455a6fde278f1d09548a71c7c0916637.zip
chromium_src-7dc3984a455a6fde278f1d09548a71c7c0916637.tar.gz
chromium_src-7dc3984a455a6fde278f1d09548a71c7c0916637.tar.bz2
Fixes possible crash in restoring a previously closed window. The
crash would occur if we pruned a tab and the index of selected tab was > tab_count - pruned_count. BUG=none TEST=make sure no problems with restoring closed windows. Review URL: http://codereview.chromium.org/18737 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8640 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index a6b3968..54adce1 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -157,6 +157,9 @@ void TabRestoreService::BrowserClosing(Browser* browser) {
delete window;
window = NULL;
} else {
+ window->selected_tab_index =
+ std::min(static_cast<int>(window->tabs.size() - 1),
+ window->selected_tab_index);
AddEntry(window, true, true);
}
}