From e38ea3de29ede0e45aab8e595da5e8e3782a396d Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 2 Apr 2020 20:51:19 +0800 Subject: ... --- src/ui/layout_control.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/ui/layout_control.cpp') diff --git a/src/ui/layout_control.cpp b/src/ui/layout_control.cpp index 3b4646e5..cb71da30 100644 --- a/src/ui/layout_control.cpp +++ b/src/ui/layout_control.cpp @@ -2,17 +2,15 @@ #include "cru/ui/window.hpp" -#include - namespace cru::ui { LayoutControl::~LayoutControl() { for (const auto child : children_) delete child; } void LayoutControl::AddChild(Control* control, const int position) { - assert(control->GetParent() == nullptr); // The control already has a parent. - assert(!dynamic_cast(control)); // Can't add a window as child. - assert(position >= 0 || + Expects(control->GetParent() == nullptr); // The control already has a parent. + Expects(!dynamic_cast(control)); // Can't add a window as child. + Expects(position >= 0 || position <= static_cast( this->children_.size())); // The position is out of range. @@ -26,7 +24,7 @@ void LayoutControl::AddChild(Control* control, const int position) { } void LayoutControl::RemoveChild(const int position) { - assert(position >= 0 && + Expects(position >= 0 && position < static_cast( this->children_.size())); // The position is out of range. -- cgit v1.2.3