summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-03-27 01:07:26 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-27 01:07:26 +0300
commit8e3641061a44cd9a78ff32b7840ee2f866ed8206 (patch)
treed9f288bfa0d33e751582eebb535d4760abc16073 /src
parent9452e1a39fe74b56b8667b088b9674358dcb52a2 (diff)
downloadmanaplus-8e3641061a44cd9a78ff32b7840ee2f866ed8206.tar.gz
manaplus-8e3641061a44cd9a78ff32b7840ee2f866ed8206.tar.bz2
manaplus-8e3641061a44cd9a78ff32b7840ee2f866ed8206.tar.xz
manaplus-8e3641061a44cd9a78ff32b7840ee2f866ed8206.zip
Fix adding possible null pointer to window.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/basiccontainer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp
index faf89f731..92611687d 100644
--- a/src/gui/widgets/basiccontainer.cpp
+++ b/src/gui/widgets/basiccontainer.cpp
@@ -63,6 +63,7 @@
#include "gui/widgets/basiccontainer.h"
+#include "utils/checkutils.h"
#include "utils/foreach.h"
#include "render/graphics.h"
@@ -79,6 +80,12 @@ BasicContainer::~BasicContainer()
void BasicContainer::moveToTop(Widget *const widget) restrict2
{
+ if (widget == nullptr)
+ {
+ reportAlways("BasicContainer::moveToTop empty widget.");
+ return;
+ }
+
FOR_EACH (WidgetListIterator, iter, mWidgets)
{
if (*iter == widget)
@@ -101,6 +108,11 @@ void BasicContainer::moveToTop(Widget *const widget) restrict2
void BasicContainer::moveToBottom(Widget *const widget) restrict2
{
+ if (widget == nullptr)
+ {
+ reportAlways("BasicContainer::moveToBottom empty widget.");
+ return;
+ }
const WidgetListIterator iter = std::find(mWidgets.begin(),
mWidgets.end(), widget);
if (iter != mWidgets.end())