diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-24 01:38:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-25 15:07:14 +0300 |
commit | 233f2b564e7707f79deb493444f28363ac10bfd4 (patch) | |
tree | ee9d960c24e68f7ce9da05ee9a0333a74615565d /src/gui/widgets/layouthelper.cpp | |
parent | 1498a699f89f7b5aebdc4629c645c3702ee04f92 (diff) | |
download | mv-233f2b564e7707f79deb493444f28363ac10bfd4.tar.gz mv-233f2b564e7707f79deb493444f28363ac10bfd4.tar.bz2 mv-233f2b564e7707f79deb493444f28363ac10bfd4.tar.xz mv-233f2b564e7707f79deb493444f28363ac10bfd4.zip |
Add missing checks on nonnull attributes to widgets.
Diffstat (limited to 'src/gui/widgets/layouthelper.cpp')
-rw-r--r-- | src/gui/widgets/layouthelper.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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; |