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

Unified Diff: ui/base/models/tree_node_model.h

Issue 7058030: ui/base/models: Reverse the DCHECKs of index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/models/tree_node_model.h
diff --git a/ui/base/models/tree_node_model.h b/ui/base/models/tree_node_model.h
index ef495b202abbe68ae3611291f15995a0b29f99d6..f4b41f8745c1dac30844bdbfdb2283d850ec3b07 100644
--- a/ui/base/models/tree_node_model.h
+++ b/ui/base/models/tree_node_model.h
@@ -74,8 +74,8 @@ class TreeNode : public TreeModelNode {
// Adds |node| as a child of this one, at |index|.
virtual void Add(NodeType* node, int index) {
DCHECK(node);
- DCHECK_LE(0, index);
- DCHECK_GE(child_count(), index);
+ DCHECK_GE(index, 0);
+ DCHECK_LE(index, child_count());
// If the node has a parent, remove it from its parent.
NodeType* parent = node->parent_;
if (parent)
@@ -116,8 +116,8 @@ class TreeNode : public TreeModelNode {
// Returns the node at |index|.
const NodeType* GetChild(int index) const {
- DCHECK_LE(0, index);
- DCHECK_GT(child_count(), index);
+ DCHECK_GE(index, 0);
+ DCHECK_LT(index, child_count());
return children_[index];
}
NodeType* GetChild(int index) {
« 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