summaryrefslogtreecommitdiff
path: root/src/gui/widgets/containerplacer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-09 00:25:50 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-09 00:25:50 +0300
commite0d14cf8d3c809a0a5291823d3a962a4835a8f6e (patch)
tree0b0720d0988e2468abc75cf68b654673f7f60a92 /src/gui/widgets/containerplacer.cpp
parent12d4d6b33e036f17a0c59fa5a0c7af2c5d0461bc (diff)
downloadmanaverse-e0d14cf8d3c809a0a5291823d3a962a4835a8f6e.tar.gz
manaverse-e0d14cf8d3c809a0a5291823d3a962a4835a8f6e.tar.bz2
manaverse-e0d14cf8d3c809a0a5291823d3a962a4835a8f6e.tar.xz
manaverse-e0d14cf8d3c809a0a5291823d3a962a4835a8f6e.zip
Add some missing checks to gui found by paranucker.
Diffstat (limited to 'src/gui/widgets/containerplacer.cpp')
-rw-r--r--src/gui/widgets/containerplacer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/widgets/containerplacer.cpp b/src/gui/widgets/containerplacer.cpp
index d393ab8ea..eefd82073 100644
--- a/src/gui/widgets/containerplacer.cpp
+++ b/src/gui/widgets/containerplacer.cpp
@@ -29,12 +29,15 @@
ContainerPlacer ContainerPlacer::at(const int x, const int y)
{
- return ContainerPlacer(mContainer, &mCell->at(x, y));
+ return ContainerPlacer(mContainer, mCell ? &mCell->at(x, y) : nullptr);
}
LayoutCell &ContainerPlacer::operator()
(const int x, const int y, Widget *const wg, const int w, const int h)
{
- mContainer->add(wg);
- return mCell->place(wg, x, y, w, h);
+ if (mContainer)
+ mContainer->add(wg);
+ if (mCell)
+ return mCell->place(wg, x, y, w, h);
+ return LayoutCell::emptyCell;
}