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

Unified Diff: chrome/browser/custom_home_pages_table_model.cc

Issue 26887002: Fix crash when drag moving URLs in chrome://settings/startup. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/custom_home_pages_table_model.cc
diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc
index 24607174635a0eab19ed825f5d08dfc3e82986d2..05f86cfeb705354e25704c0464531aa61e3427c6 100644
--- a/chrome/browser/custom_home_pages_table_model.cc
+++ b/chrome/browser/custom_home_pages_table_model.cc
@@ -96,9 +96,14 @@ void CustomHomePagesTableModel::SetURLs(const std::vector<GURL>& urls) {
*/
void CustomHomePagesTableModel::MoveURLs(int insert_before,
const std::vector<int>& index_list) {
- DCHECK(!index_list.empty());
DCHECK(insert_before >= 0 && insert_before <= RowCount());
+ // This is a bug. This should be a DCHECK, but under circumstances, the JS can
+ // get confused and pass us an empty list of selected indices to drag move.
Dan Beam 2013/10/14 18:08:07 Are you sure it's the WebUI's fault? This can only
+ // See http://crbug.com/302284.
+ if (index_list.empty())
Dan Beam 2013/10/14 18:08:07 NOTREACHED();
+ return;
+
// The range of elements that needs to be reshuffled is [ |first|, |last| ).
int first = std::min(insert_before, index_list.front());
int last = std::max(insert_before, index_list.back() + 1);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698