Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: chrome/browser/ui/webui/options/startup_pages_handler.cc

Issue 47033003: Fix "Set pages" drop crash by changing outside drags to simply add a new URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/startup_pages_handler.cc
diff --git a/chrome/browser/ui/webui/options/startup_pages_handler.cc b/chrome/browser/ui/webui/options/startup_pages_handler.cc
index f58b6bc5c5df534719ff50f2e2a1da22c050fec3..343b2a68a6d775d6c1d28e576b9838ae0d3e3e8b 100644
--- a/chrome/browser/ui/webui/options/startup_pages_handler.cc
+++ b/chrome/browser/ui/webui/options/startup_pages_handler.cc
@@ -151,13 +151,17 @@ void StartupPagesHandler::RemoveStartupPages(const ListValue* args) {
void StartupPagesHandler::AddStartupPage(const ListValue* args) {
std::string url_string;
- CHECK_EQ(args->GetSize(), 1U);
CHECK(args->GetString(0, &url_string));
GURL url = URLFixerUpper::FixupURL(url_string, std::string());
if (!url.is_valid())
return;
- int index = startup_custom_pages_table_model_->RowCount();
+
+ int row_count = startup_custom_pages_table_model_->RowCount();
+ int index;
+ if (!args->GetInteger(1, &index) || index > row_count)
+ index = row_count;
+
startup_custom_pages_table_model_->Add(index, url);
}

Powered by Google App Engine
This is Rietveld 408576698