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

Unified Diff: ui/views/view_model.cc

Issue 298963004: app_list: Fix possible out of bounds index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK -> CHECK Created 6 years, 7 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 | « ui/app_list/views/test/apps_grid_view_test_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view_model.cc
diff --git a/ui/views/view_model.cc b/ui/views/view_model.cc
index 5f492f5380d7b27e0114dca16fa333bda0f377ec..a0a754964508c83023fceda8da5cef8f1fcabcb0 100644
--- a/ui/views/view_model.cc
+++ b/ui/views/view_model.cc
@@ -33,6 +33,11 @@ void ViewModel::Remove(int index) {
}
void ViewModel::Move(int index, int target_index) {
+ DCHECK_LT(index, static_cast<int>(entries_.size()));
+ DCHECK_GE(index, 0);
+ DCHECK_LT(target_index, static_cast<int>(entries_.size()));
+ DCHECK_GE(target_index, 0);
+
if (index == target_index)
return;
Entry entry(entries_[index]);
« no previous file with comments | « ui/app_list/views/test/apps_grid_view_test_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698