summaryrefslogtreecommitdiffstats
path: root/views/view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/view.cc')
-rw-r--r--views/view.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/views/view.cc b/views/view.cc
index f4869ec..a8de837 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -518,6 +518,8 @@ void View::AddChildView(View* v) {
}
void View::AddChildView(int index, View* v) {
+ CHECK(v != this) << "You cannot add a view as its own child";
+
// Remove the view from its current parent if any.
if (v->GetParent())
v->GetParent()->RemoveChildView(v);