Chromium Code Reviews| Index: cc/trees/property_tree.h |
| diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h |
| index 209c8a98715c1c2065a8b8d9a923e6c2ca95d7da..f0d2b5059eada3349b07cb0ffbb76c526b7b9282 100644 |
| --- a/cc/trees/property_tree.h |
| +++ b/cc/trees/property_tree.h |
| @@ -141,8 +141,14 @@ class CC_EXPORT PropertyTree { |
| int Insert(const T& tree_node, int parent_id); |
| - T* Node(int i) { return i > -1 ? &nodes_[i] : nullptr; } |
| - const T* Node(int i) const { return i > -1 ? &nodes_[i] : nullptr; } |
| + T* Node(int i) { |
| + CHECK(i < static_cast<int>(nodes_.size())); |
|
ajuma
2015/05/19 20:06:23
I think it's a good idea to land these CHECKs to h
Ian Vollick
2015/05/19 21:11:48
Done.
|
| + return i > -1 ? &nodes_[i] : nullptr; |
| + } |
| + const T* Node(int i) const { |
| + CHECK(i < static_cast<int>(nodes_.size())); |
| + return i > -1 ? &nodes_[i] : nullptr; |
| + } |
| T* parent(const T* t) { return Node(t->parent_id); } |
| const T* parent(const T* t) const { return Node(t->parent_id); } |