summaryrefslogtreecommitdiff
path: root/src/gui/widgets/layouthelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-24 01:38:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-25 15:07:14 +0300
commit233f2b564e7707f79deb493444f28363ac10bfd4 (patch)
treeee9d960c24e68f7ce9da05ee9a0333a74615565d /src/gui/widgets/layouthelper.cpp
parent1498a699f89f7b5aebdc4629c645c3702ee04f92 (diff)
downloadmv-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.cpp14
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;