From 233f2b564e7707f79deb493444f28363ac10bfd4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Jun 2015 01:38:17 +0300 Subject: Add missing checks on nonnull attributes to widgets. --- src/gui/widgets/layouthelper.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/gui/widgets/layouthelper.cpp') diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp index caf7df58e..5296c69bc 100644 --- a/src/gui/widgets/layouthelper.cpp +++ b/src/gui/widgets/layouthelper.cpp @@ -32,12 +32,14 @@ LayoutHelper::LayoutHelper(BasicContainer2 *const container) : mLayout(), mContainer(container) { - mContainer->addWidgetListener(this); + if (mContainer) + mContainer->addWidgetListener(this); } LayoutHelper::~LayoutHelper() { - mContainer->removeWidgetListener(this); + if (mContainer) + mContainer->removeWidgetListener(this); } const Layout &LayoutHelper::getLayout() const @@ -49,7 +51,8 @@ LayoutCell &LayoutHelper::place(const int x, const int y, Widget *const wg, const int w, const int h) { - mContainer->add(wg); + if (mContainer) + mContainer->add(wg); return mLayout.place(wg, x, y, w, h); } @@ -61,11 +64,14 @@ ContainerPlacer LayoutHelper::getPlacer(const int x, const int y) void LayoutHelper::reflowLayout(int w, int h) { mLayout.reflow(w, h); - mContainer->setSize(w, h); + if (mContainer) + mContainer->setSize(w, h); } void LayoutHelper::widgetResized(const Event &event A_UNUSED) { + if (!mContainer) + return; const Rect area = mContainer->getChildrenArea(); int w = area.width; int h = area.height; -- cgit v1.2.3-70-g09d2